The Digital Man Posted February 14, 2005 Share Posted February 14, 2005 O.K. I want to know what is the best way to duplicate a record and all its children. I was going to set up a loop and loop through the children creating a new child record for each one but then I thought surely there must be a better way. JOBS is my main record database. COMPONENTS is my children record database. So say the user is on JOB #349 (the ID is 349) and this particular job has 6 COMPONENT records associated with it. COMPONENTS ID will be say 401-406. COMPONENTS JOBID of course will all be 349. The user pushes the DUPLICATE JOB button. I've scripted a SET FIELD where I store the JOB ID (i.e. 349) into a global field. Then I've scripted a DUPLICATE RECORD/REQUEST which produces another JOB record. I've then stored that JOB ID into another global field. Now I'm ready to duplicate the 6 children records so I scripted a GOTO COMPONENTS LAYOUT step. What do I do next? I'm on a layout where the 6 children records are being shown. Thanks for the help. Link to comment Share on other sites More sharing options...
aaa Posted February 15, 2005 Share Posted February 15, 2005 Goto Record First Loop Duplicate Record Goto Next Record(Exit after last) EndLoop Link to comment Share on other sites More sharing options...
The Digital Man Posted February 15, 2005 Author Share Posted February 15, 2005 Thank you so much aaa. I figured looping was probably the way I had to go but wasn't sure how to code it. Your example was MOST helpful and appreciated. I also thought that maybe the folks at Filemaker had made some cool new command that would just duplicate a whole brood of children for a record. I guess that will be for a later upgrade. Although I am not looking forward to another one anytime soon. I'm struggling to wrap my head around this last one. I added one statement immediately following the duplicate step where I changed the JOBID to the NEW JOBID that I had stored in my global variable. That way all the new children belong to the new JOB record. It works like a charm! Thanks again. Link to comment Share on other sites More sharing options...
aaa Posted February 16, 2005 Share Posted February 16, 2005 "I added one statement immediately following the duplicate step where I changed the JOBID to the NEW JOBID that I had stored in my global variable". When i posted script i was sure that you can do it. Link to comment Share on other sites More sharing options...
aaa Posted February 16, 2005 Share Posted February 16, 2005 I added one statement immediately following the duplicate step where I changed the JOBID to the NEW JOBID that I had stored in my global variable. When i posted script i was sure that you can do it. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.