The script at: Duplicating Bill Of Materials (duplicating portal line items) doesn't do that. Some part of your script differs from the example. Without being able to see that script, it is pretty much impossible to tell you where/why it is going wrong for you.
To post a script to the forum:
- You can upload a screen shot of your script by using the Upload an Image controls located just below Post a New Answer.
- You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
- If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
- If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
Here is the script.
After running the script debugger, I think the issue is with the GTRR. When I "step into" that step, and it enters find mode, it is not bringing up the correct related records based on the _pkCohortID (the unique key, generated on creation).
Thanks for your help!
"Enters find mode"?????
No part of this script enters find mode. Are you sure that you were performing the script you've posted here?
The IF step checks for the existence of related records before executing the GTRR. If there are no related records, nothing happens in your script beyond duplicating the parent record. IF there are related records the GTRR should pull them up in a found set on the "session data all programming" layout for duplication.
it duplicated the current parent record details, but then is going back and grabbing the portal records from the first parent record I have.
That suggests that your script is somehow switching to the wrong parent record. The script listed should not do that. Are there any script triggers set up on this layout? Say the OnRecordLoad script trigger?
Are the parent records sorted or unsorted when you run this script? If sorted, is the "keep records in sorted order" option specified?
Thank you! It was a script on the layout that I had forgotten to remove, and no longer needed. Once that was cleared, everything ran perfectly! I was even able to insert "clear" functions to clear out the items that do change.