getnext and loop?? - braindead question

Scott Walker ScottWalker at RAMSystemsCorp.com
Wed Oct 13 10:26:52 PDT 2010


Scotter6 said:

-----Original Message-----
From:
filepro-list-bounces+scottwalker=ramsystemscorp.com at lists.celestial.com
[mailto:filepro-list-bounces+scottwalker=ramsystemscorp.com at lists.celestial.
com] On Behalf Of scooter6 at gmail.com
Sent: Wednesday, October 13, 2010 11:50 AM
To: filePro Mailing List
Subject: getnext and loop?? - braindead question

Okay, in the midst of a gazillion projects so my mind is not thinking
clearly...

We previously had a process called within a screen that requests a letter to
be sent.
We have processing in place that USED to work but doesn't seem to now??  Or
perhaps it's been broken a while and we never caught it...who
knows...anyways...

>From a screen, we can hit '4' to request a letter....it then looks up the
letter file and is supposed to check the 'most recent date' we sent a letter
and if that date is
less than 14 days from today's date, it's supposed to errorbox "last letter
was sent" <x<"days ago, please make sure you wait 14 days";exit etc

So in checking this out, it appears it's only grabbing the FIRST record that
matches the account number (which is how we lookup to the letter file)

So, the way it SHOULD work, is the lookup should look in the letter file at
ALL records that match the account number and find the MOST RECENT letter
and compare the date to today's date, etc......
I put a piece of code in to show me what value it was checking - apparently
it's only finding the first record it locates by the account number and it's
checking against THAT date --
How can I put processing in place to lookup to the letter file by account
number, then locate the most recent date instead of just the first record it
finds?

i.e.  letter file contains 4 letter records for account number 123456  (it
does a lookup by account number from our master file)
The 4 letter requests were sent on:
01/05/10
02/17/10
05/26/10
10/07/10

Right now, when I put my msgbox to show me what date we're checking against,
it's locating the first record, and checking today's date vs. 01/05/10 - and
since it's more than 14 days ago, it allows them to request another letter -
obviously not what I want to happen.....it needs to see we printed the last
letter 6 days ago and should not allow them to request another one, etc.....



Scott Walker says:

There are several easy ways to do it.  Build an index on Account# & Date (in
descending order).  Then when you do the lookup using this index, you will
be getting the most recent letter.

Or....

You could do the lookup as you currently are but loop through all the
records that match the account#, remembering the most recent date.  When you
are done looping through all records for the account, do your compare
against the most recent date encountered.


Regards,

Scott






More information about the Filepro-list mailing list