1 Reply Latest reply on Jul 22, 2010 9:37 AM by philmodjunk

    Creating new records in related file/table



      Creating new records in related file/table


      I have two seperate Filemaker files: Projects and Address Lookup

      I want to have a new record created in the Address Lookup file when I create a new unique record in Projects and have some of the field information from the Projects file new record automatically entered into the new record in the Address Lookup file.

      I have a relationship between the two files based on a ProjID that is an auto-serial in Projects. And I have tried  a Set Field script-step in Projects but it doesn't work:

      New Record/Request

      Set Field [Address Lookup:;project id; Projects:;Project ID]
      Set Field [Address Lookup:;organization; Projects:;Organization]
      Set Field [Address Lookup:;contact; Projects:;contact]
      Set Field [Address Lookup:;contact phone; Projects:;contact phone]
      Set Field [Address Lookup:;address; Projects:;address]

      I have tried it with and without the project id set field. When I run the script it just creates a blank record in Projects.

      Is there any way to have it do what I want and have it done automatically?

        • 1. Re: Creating new records in related file/table

          One method that doesn't require a script, is to enable the "allow creation of records via the relationship" option for your relationship and then put a portal to address on your projects layout. You can then simply enter data in the blank fields of the portal and the Project ID value will be entered for you by filemaker. You can also define looked up values that copy data from one table to another once the Project ID value is entered.

          However, this all looks a bit backward to me. Couldn't one address link to several projects? (Maybe not if these are construction projects of something.)

          If so, I'd have an addressID serial number in Address and a matching number field in projects and link address records to projects by entering an addressID from the address table into an addressID field in projects.

          PS. your script doesn't work because you can't refer to Projects::Project ID from the address layout as you haven't yet assigned a value to address::project id. You'd have to store Project ID in a variable before changing layouts and making a new record.