4 Replies Latest reply on May 22, 2014 9:04 AM by nihmbrisby

    Duplicate Record Target



      Duplicate Record Target


           I had a duplicate record script working fine.  

           On a contacts layout, i have a portal.  Each portal row has a popover.  A button in the popover activates the script that has the duplicate record step.  It would duplicate the record corresponding to that row of the portal

           Later, I went into the 'tab order setup' menu and pressed 'clear all.'  Now, when I run the script, it tries to duplicate not the record from the portal row, but the record on which the portal resides.

           I then looked at a backup.  I restored the relative tab orders of the portal row and the buttons in the portal.  It works fine again.

           So everything is working again, but I'd like to have a better understanding of how the duplicate step finds its target record.  I've read its description on the filemaker resources website, searched the forums for that particular script step, refered to the 'missing manual (fmp12), and the fmp12 dev's reference book all with no luck.  Any insight would be apreciated

        • 1. Re: Duplicate Record Target

               It would help to see the actual script that you are using.

               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.
          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.)
          5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
          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: Duplicate Record Target

                 Thanks Phil.  Here's the script.  Two foreign keys are flipped, and two relation (employer becomes employee) types are flipped.  RelationReciprocalexists is just  a field I use for conditional formatting (when it's 'Yes' the button that runs this script is hidden):

            •           Set Field [ join_Contacts_Contacts::RelationReciprocalExists; "Yes" ]
            •           Set Variable [ $fkContactsID; Value:join_Contacts_Contacts::_fkContactsID ]
            •           Set Variable [ $fk_relations_ContactsID; Value:join_Contacts_Contacts::_fk_relations_ContactsID ]
            •           Set Variable [ $RelationRecip; Value:join_Contacts_Contacts::RelationReciprocalType ]
            •           Set Variable [ $Relation; Value:join_Contacts_Contacts::RelationType ]
            •           Duplicate Record/Request
            •           Set Field [ join_Contacts_Contacts::_fkContactsID; $fk_relations_ContactsID ]
            •           Set Field [ join_Contacts_Contacts::_fk_relations_ContactsID; $fkContactsID ]
            •           Set Field [ join_Contacts_Contacts::RelationType; $RelationRecip ]
            •           Set Field [ join_Contacts_Contacts::RelationReciprocalType; $Relation ]
            •           Commit Records/Requests [ No dialog ]
            •           Close Popover


                 Default tab order- script work.  The record represented on the portal row (in join_contacts_contacts) is duplicated.  

                 No tab order- the Contact record is duplicated.



            • 3. Re: Duplicate Record Target

                   I'm surprised that works with or without the tab order.

                   Any time that I've used Duplicate Record/Request, it's duplicated the current record in the layout's found set--not the current record in a portal row.

                   Just to be sure, I made a copy of a layout where I have several portals used for data entry and where they have "allow creation..." enabled.

                   I tried with both a plain button inside the portal row and with a button placed in the popover whose button is inside the portal row.

                   In both cases the script duplicated the layout's record--not the portals and this is what I would expect to happen.

                   Any time that I've needed to duplicate a portal record, I've used either a scripted find or Go to Related Records to bring that record up on a layout based on the portal's record and used duplicate record in that context to duplicate the portal record and not the layout's record.

              • 4. Re: Duplicate Record Target

                     That's it, thanks Phil.  I introduced a go to related record step, and I'm reading your "The Complete Go To Related Record" post to try and get it right.