Solved

pull the last record

Posted on 2004-04-22
6
153 Views
Last Modified: 2010-04-17
I have this code and in the first part of the if statment it pulls the first record. What I need it to be able to count all the records first and then only pull the last record. not sure on how to set up the loop. Here is the code

Dim Result
Dim index
Dim temp_val
If IsMissing(vElementIndex) Then vElementIndex = 1
'----------------------------------------------

If val(CDE.LT-MISC-INFO2.UNDERWRITE-SYS) = 2 Then
      Let result = CDE.LT-PROSPECT-REQ.FNMA-CASE-ID(1)
ElseIf val(CDE.LT-MISC-INFO2.UNDERWRITE-SYS) = 1 Then
      Let result = CDE.LT-DELIVERY.FHLMC-LN-NBR
End If
0
Comment
Question by:cdb424ttm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 6

Expert Comment

by:pillbug22
ID: 10892879
Is this pulling from a DB?  If you are using an AutoID field, you can do

SELECT MAX(id) FROM <tableName> WHERE <criteria>
0
 

Author Comment

by:cdb424ttm
ID: 10892977
no I'm not.
0
 

Author Comment

by:cdb424ttm
ID: 10893533
how do you set up a count loop?
I want it to loop through and get a count
0
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

 

Author Comment

by:cdb424ttm
ID: 10895441
I guess I'm looking for something like this for the first part of the if loop where it will loop thru all the sys = to 2  

If val(CDE.LT-MISC-INFO2.UNDERWRITE-SYS) = 2 Then

index  = 1
do
     Let result = CDE.LT-PROSPECT-REQ.FNMA-CASE-ID
index = index +1
loop until  CDE.LT-PROSPECT-REQ.FNMA-CASE-ID = "" 
0
 

Author Comment

by:cdb424ttm
ID: 10895449
would that be a correct statment?
0
 
LVL 8

Accepted Solution

by:
rajaloysious earned 500 total points
ID: 10896271
You can use Do While loop.
Code follows:
index = 1
Do while CDE.LT-PROSPECT-REQ.FNMA-CASE-ID <> ""
         index = index +1
         Let result = CDE.LT-PROSPECT-REQ.FNMA-CASE-ID
Loop
''We have reached the last record and result will have the last record.
-----------
You can use Do loop also
index = 1
   Do
     index = index +1
      Let result = CDE.LT-PROSPECT-REQ.FNMA-CASE-ID
   Loop While CDE.LT-PROSPECT-REQ.FNMA-CASE-ID <> ""
-------------
You can use while statement
index = 1
   While CDE.LT-PROSPECT-REQ.FNMA-CASE-ID <> ""
      index = index - 1
       Let result = CDE.LT-PROSPECT-REQ.FNMA-CASE-ID
   End While

Good Luck
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question