4 Replies Latest reply on Jul 30, 2013 1:57 PM by K_3

    Populating data from field in current record to a new record

    K_3

      Title

      Populating data from field in current record to a new record

      Post

           Two tables.  Personnel & Meeting.

           Both tables have a field called name. These fields have a relationship set.

           If I'm in the personnel table, I want to click a button that opens a new record in the meeting table with the name field populated based on the name field from the record I was on in the personnel table.

           I got the button to run a script that opens a new record in the personnel table, but don't know how to get the name field populated.

        • 1. Re: Populating data from field in current record to a new record
          philmodjunk

               What match fields have you specified in the relationship? Do you use an auto-entered ID?

               Why COPY the data in the field? With a valid relationship linking the two records, you can simply place the name field from personnel on the meeting layout and the field will display the needed name.

          • 2. Re: Populating data from field in current record to a new record
            K_3

                 The relationship is many to many.

                 I just replaced the name field in meetings to be the name field from personnel.  That did not acheive the result.

                 To be a little more specific... If I've clicked on John's name in the Personnel table,  I'd like to click a button that opens a new record in the Meetings table with "John" already in the Name field there.

                 I've included a screen shot of the relationship.  The tables have different names, but it should be apparent how they correspond.

            • 3. Re: Populating data from field in current record to a new record
              philmodjunk

                   Your screen shot shows a table occurrence named "checkin" and another named "Team Membor infor..." Which is for Meetings and which for Personnel?

                   Assuming that Team Member infor... is the personnel table:

                   Set Variable [$Name ; value : Team Member Information::Name ]
                   Go to Layout ["Checkin" (Checkin)]
                   New Record/Request
                   Set Field [Checkin::Team Member ; $Name ]

                   

                        The relationship is many to many.

                   Actually, this looks like a one to many relationship, but FileMaker can't tell that from the match fields and their field options and so you get "crows feet" on both ends of the relationship line. But linking tables by Name is rarely a good idea. Names are not unique, people change their names and names are vulnerable to data entry errors. LInking by an ID number of UUID would make for a better pair of match fields in your relationship.

              • 4. Re: Populating data from field in current record to a new record
                K_3

                     That did the trick, thanks!  Any suggestions on resources for learning/understanding real life use of scripts?