Help with script/loop..
I'm a newbie at writing a loop in script, and would appreciate a little help getting started.
I have records in a table that has duplicates. These are aircraft N Numbers of planes owned by members. The duplicates occur when a member sells his plane to someone else. So..I might have records that look like this: (There are more fields, but these are the ones I need to work with). The two fields are: N_Number (which contains the N Number), and Inactive (which contains either "I" or "A").
N426TC "I" (the "I" is the content of a field called Inactive indicating that the member sold the plane and is now Inactive)
N426TC "A" (the "A" is the content of a field called Invactive indicating that the owner is a current member/owner)
This group I would want to ignore. That is, I would want to remain in the loop and not print the record in the report.
Then, there might be a group of duplicates like this:
This indicates that the last owner/member sold the plane, but the new owner has not joined as a member, or he didn't renew his membership, but still owns the plane. I would want to print this record on the report in either case.
My idea was to store the N_Number and the Inactive field contents as Global fields. Then in the loop reset these when the N_Number changes. At that time if the Global Inactive fleld content was "I" (meaning all the group were "I", then exit and do the output, but if at that time the Global Inactive field contaents was "A", then I want to reset the Global fields and stay in the loop and look at the next record, which would be the first in the next group of duplicates.
Or, is there a better way to do this?
Check out the "Last" function. It make take a tweak to your table design to take advantage of it, but it would make the task you describe a bit easier.