2 Replies Latest reply on Jan 27, 2012 5:14 AM by Jonna

    Trigger a new record in a related table?



      Trigger a new record in a related table?


      "... when this option is selected, entering data in a related field that has no corresponding related record creates a related record based on the match field in the current table."

      Does this sentence (in the help) mean that a user can trigger FM to create a new record in an another, related table? Is this a way to duplicate my records into another table (and use a lookup)?

      I've never fully understood how relations work in FM, I've managed to stumble my way to somehow create lookups...

        • 1. Re: Trigger a new record in a related table?

          It's one method that can be set up to work, but would require either user a action or a script to carry out.

          Typically, this option is enabled so that when you put a portal to the related record on your layout, you can create new related records by entering data into the bottom blank row of the portal. FileMaker, in that situation, will copy the needed match values from your layout's parent record into the new related portal records so that the records are correctly linked in your relationship.

          It's also possible to just put a field from the related table on a layout based on the other table in this relationship. In that case, entering data into this field will create a new related record, if one does not already exist. If a record already exists, entering data into this field just modifies the data for this field in the related record.

          Scripts can use Set Field to take advantage of this relationship setting to create related records much like you would by entering data manually in either of the above two manual scenarios.

          WIth scripting, there are other approaches that can automate the creation of a related record.

          You could use this method to duplicate a record in another related table if you specified looked up value settings for every data field in the related table's record, but it's not the only option.

          Import records can also be used to copy the data from one table to another and a script can use the relationship, variables or global fields to transfer data one field at a time.

          But keep in mind that often the best way to copy a record is not to copy it at all but to modify your design so that such duplication of your data is unecessary.

          • 2. Re: Trigger a new record in a related table?

            Thanks for your thorough answer, PhilModJunk, I understand a few things better now.