4 Replies Latest reply on Jul 29, 2014 10:08 AM by NonProfitEducationUser

    Duplicating Portal Records with parent layout

    NonProfitEducationUser

      Title

      Duplicating Portal Records with parent layout

      Post

           Hi,

           I have been using this post to help me set up a script to duplicate the portal records when I duplicate the parent record; and it's been a huge help.

           http://forums.filemaker.com/posts/ac6afe2913

           For the most part, it's working. But, rather than copying the portal records from the record I'm in when I run the script, it duplicated the current parent record details, but then is going back and grabbing the portal records from the first parent record I have. What part of the script to do I need to edit? (I also realize this is from around FMP 11, and I'm using 13 now, but didn't think that would matter).

           More details:

           I have a parent record for each group of students (groups A,B,C, for example). Then I have a tab with a portal that shows what their topic was on different days, along with the date (ie: 1/1/14; addition; 1/2/14; subtraction). When I create group A, I want to be able to duplicate everything- including the dates and topics because those are often exactly the same, I just see group B during a different time.

            

           Everything in the script given seems to be working well, except grabbing the portals from the wrong parent. I've tried changing a few things, and just can't seem to get it to pull the correct records.

           Thanks for any help!

        • 1. Re: Duplicating Portal Records with parent layout
          philmodjunk

               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:

                 
          1.           You can upload a screen shot of your script by using the Upload an Image controls located just below Post a New Answer.
          2.      
          3.           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.)
          4.      
          5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
          6.      
          7.           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.
          • 2. Re: Duplicating Portal Records with parent layout
            NonProfitEducationUser

                 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!

            • 3. Re: Duplicating Portal Records with parent layout
              philmodjunk

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

              • 4. Re: Duplicating Portal Records with parent layout
                NonProfitEducationUser

                     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.

                     Thanks again!