1 Reply Latest reply on Apr 1, 2011 11:40 AM by philmodjunk

    Automatically creating records and filling some fields

    WilliamdelaMaza

      Title

      Automatically creating records and filling some fields

      Post

      I got a table (table1) from which I need to automatically create records in a separate but related table (table2) inside the same file. After these records get created, I need to auto-fill some fields with data from table1.

      Table2 is going to be previously cleared-off all records before this record creation-procedure takes place, so there's nothing to mess-up there.

      My questions are:

      How can create empty records on table2 based on the existing records from table1?

      How can I force FileMaker to fill some of the fields on table2 using data from table1?

      I need to do this preferably with a single button. Can it be done?

        • 1. Re: Automatically creating records and filling some fields
          philmodjunk

          Basic script for creating a new related record in table2. (Easiest way to "auto-fill" data from table 1 is to link them in a relationship.)

          #Perform script from layout based on Table1
          Set Variable [$key ; value: Table1::PrimaryKeyField]
          Go To Layout [Table2layout]
          New Record/Request
          Set Field [Table2::ForeignKeyField ; $key]
          Go To Layout [original layout]

          This creates one new record in Table2 linked to the current Table1 record on the original layout. The auto-fill of data can take place automatically once the correct value is entered into table2's foreign key field.

          There are two ways to set up your auto-fill. One way is a static link that physically copies data from table1. The other is a dynmaic link that simply refers to the fields in Table1. The best option for you depends on how you intend to use this data that you want to "auto fill". See the following link for a description and discussion of both options:

          Auto Fill