AnsweredAssumed Answered

Same-Table Find, Loop, and Write

Question asked by James_L on May 12, 2013
Latest reply on May 12, 2013 by James_L


Same-Table Find, Loop, and Write


     I've got a table of records that need to be periodically sifted for field-entries corresponding to variables $$Search_Variable_1 and $$Search_Variable_2, with some fields from the resulting find written back into the same table with a third variable $$Type in the "Type" field.

     The trouble is that when I do my Find (using an Enter Find mode in the table's layout Table_1_Layout) and perform my loop to write the records, I run into some sort of snag in the loop, writing only one of the records.  I suspect that by going back into the layout Table_1_Layout to write the record, I invalidate the find or something.  But I'm only getting one record written.

     Here's my script:


      Go to Layout ["Table_1_Layout" (Table_1)]

     Unsort Records

     Enter Find mode []

     Set Field [Table_1 :: COB_ID_FK; $$Search_Variable_1]

     Set Field [Table_1 :: COB_ID_Type; $$Search_Variable_2] 

     Perform Find []

     Go to Records / Request/Page [First]


     Set Variable [$Person_ID; Value: Table_1 :: Personnel_ID_FK

     Go to Layout ["Table_1_Layout" (Table_1)]

     New Record / Request

     Set Field [Table_1_Layout :: Type; $$Type

     Set Field [Table_1_Layout :: Personnel; $Person_ID]

     Set Field [Table_1_Layout :: Inventory_ID_FK; $$Search_Variable_1

     Go To Record/Request/Page [Next ; Exit after last]

     End Loop


     Is it possible to sift / find records, alter a couple of fields using variables, and then rewrite them back to the same table?   What am I missing?