3 Replies Latest reply on Jan 22, 2015 7:51 PM by philmodjunk

    Duplicating a Record

    TKnTexas

      Title

      Duplicating a Record

      Post

      When I delete a record there is a built-in provision to delete the master and the related records.  I need to script a duplication button for a record with related records.  

      1)  Duplicate the Parent, capturing the new Key Field in a variable.  
      2)  Return to the Original record and then GTRR to duplicate them replacing the Key Field with the new Key Field.  

      Have I covered the basics?  Any caveats, warnings?

        • 1. Re: Duplicating a Record
          philmodjunk

          It can make a difference whether you start from a found set of a single parent record or multiple records. See the script example at the end of this thread: Duplicating Bill Of Materials (duplicating portal line items)

          • 2. Re: Duplicating a Record
            TKnTexas

            I am working in a checkbook table.  I am writing a little "Quicken" database .. as a learning device.  Since I am salaried with direct deposit, I want to duplicate the deposit, with the child records the earnings and deductions, so typically all records will be shown.  I would scroll to last deposit, click on the "DUP" button, setting date to TODAY.  Then the child records need to reflect the new parent.

            • 3. Re: Duplicating a Record
              philmodjunk

              This is all covered in the thread that I posted a link to. The first script in the thread works off of a single record found set or when the record to be duplicated is the last record. Someone pointed out that this script didn't work when the record to be duplicated was not the last record and thus I came up with the script posted at the end of the thread that does duplicate parent and child records correctly regardless of it's position in the found set.