5 Replies Latest reply on Sep 14, 2011 9:22 AM by mgores

    Duplicating records

    GeorgeMcNamara

      Title

      Duplicating records

      Post

       I have a training database and when training a department on the same subject, i would like to duplicate the record but change the name of the trainee only. I would like to do this from a checkbox where I check the desired trainees and the record duplicates everything exactly but updates the trainees until the list (checkboxes) are satisfied. I am open to any solution that will produce this result, I am not married to my vision of it.

        • 1. Re: Duplicating records
          philmodjunk

          And we really have no idea what that vision might be as you haven't shared it.Wink

          This script does what you request:

          Set variable [$List ; value: Yourtable::YourCheckboxField]
          Loop
             Set Variable [$I ; Value: $I + 1 ]
             Exit Loop If [$I > valueCount ( $List ) ]
             Duplicate Record
             Set Field [YourTable::YourNameField ; getvalue ( $List ; $I ) ]
          End Loop

          • 2. Re: Duplicating records
            mgores

            I would have separate tables for TrainingEvents and trainees with a join table between them.  I just had Phil help me with a similar solution that allows you to have two portals, then click on each person and have them move over from a list of possibles to a list of attendees.  You can then have a different layout for each event that will just list the attendees, or a layout for employees that lists the training events they attended.

            • 3. Re: Duplicating records
              GeorgeMcNamara

               Thanks Phil, Exacly what I en-vision-ed, works like a charm!

              • 4. Re: Duplicating records
                GeorgeMcNamara

                 Mark, that solution sounds interesting for another database I have...any specific details Phil provided you that got you rolling?

                • 5. Re: Duplicating records
                  mgores

                  It works kind of like the sort dialog where you move field names from the left window to the right window.

                  Mine was to track scouts and events

                  I had 3 tables - scouts---<scoutEvents>---events

                  The set up two other table occurences of scouts and events, I called them scoutlist and event list, and set up the relationships to be

                  scouts  X eventlist  and  events  X  scoutlist   //these are the cartesan relationships that will allow you to show all of the list records in a portal

                  Then on an Event based layout set up two portals, one (possible attendees) is based on the scoutlist relationship and the other (attendees) is based on the scoutEvents relationship.  I put the scout name field in each portal and set up field in possible attendees as a button to run the script that creates the new record in the scoutEvents table, which causes that scout to now show up in the attendees portal.  Then a portal filter on the possible attendees portal removes them from the possible list.  I suppose you could add a delete portal row script to the attendees side that would take the person out of the attendees list and move them back to the possibles list.  In fact I will probably do that in mine in case the user accidentally clicks the wrong name, a strong possibility since I envision this being used in FMGo.