1 Reply Latest reply on Dec 14, 2009 5:39 AM by ninja

    Help with script/loop..

    RCaauwe

      Title

      Help with script/loop..

      Post

      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  "I"

      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:

       

      N555AB "I" 

      N555AB "I"

      N555AB "I"

       

      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?