FredP Posted March 10, 2008 Share Posted March 10, 2008 I have a script where I am trying to clone some records so that a copy of them are created and linked to another project by duplicating the record, and changing the parent_projectID for the new record. But i hit a snag. I do a find, that lets say returns 3 records. I planned to do a script that was as easy as Goto first record Loop Duplicate Record Set Field ParentRecordID# to $newRecordId Goto Next Record Exit on last end loop But this causes a problem. With 3 records found, when I duplicate a record, the new duplicate becomes record #4 in the found set, thus when it changes, the record id and tries to "goto next record, exit on last" it exits, because the new record, #4, is the last in the found set. Is there any way around this? I would like to retain the order So that I can loop through the 3. Help! Fred Link to comment Share on other sites More sharing options...
FredP Posted March 10, 2008 Author Share Posted March 10, 2008 I found the solution in another post: Anyone who is interested, the loop script looks like this. Loop Exit Loop if [get(foundcount)=0] Duplicate Record/Request Set Field [template_items::kf_template_id; ""] -- (this clears the template_id so that the original template does not have the new duplicated records associated with it) Set Field [template_items::kf_trip_id; $$trip_id] Omit Record Go to Record/Request/Page [First] Omit Record End Loop Original thread http://filemakertoday.com/com/showthread.php?t=11336 That did the trick for me, thank you all!!!! Fred Link to comment Share on other sites More sharing options...
Norma_Snockurs Posted March 11, 2008 Share Posted March 11, 2008 I think you need 'Go to Record/Request/Page [First]' as an additional first step before the loop starts. If the initial record that the loop encounters happens not to be the first record of the found set then the first record won't get duplicated because it gets omitted at the final step of the initial loop pass. Link to comment Share on other sites More sharing options...
FredP Posted March 11, 2008 Author Share Posted March 11, 2008 Yes, Sorry, i tleft that out, but my script did indeed include that. Thanks, that will help anyone else who references this thread. Have a good day! Fred Link to comment Share on other sites More sharing options...
Recommended Posts