3 Replies Latest reply on Jul 11, 2017 6:47 AM by beverly

    Accessing a field in a different file/database.

    denns

      Hypothetically...

       

      I have 2 files (separate databases): file1.fmp12 and file2.fmp12

      Each file has one field: field1.

      I want too access/lookup file2:field1 from file1.

       

      What is the syntax?

        • 1. Re: Accessing a field in a different file/database.
          philmodjunk

          "access" and "lookup" aren't necessarily the same thing. "Lookup" in FileMaker terms means to copy the data from one table to the other, but sometimes copying the data is not what you should do. So some more information would be needed to better help you get this to work.

           

          But here's some general information:

           

          Go to Manage | Database | Relationships in file 1.

           

          Click the button at far left on the bottom edge of the window to add a new table occurrence box to your relationship.

          A dialog will open, use the drop down near the top of the dialog to select the "add FileMaker data source" option. Select File 2 and then select the table in File 2 from which you want to look up this data.

           

          You now have added an occurrence of this table from file 2 to the relationship graph of file 1. You can now link these two table occurrences in a relationship that in turn will control how any lookup of data from this file 2 table will work.

          • 2. Re: Accessing a field in a different file/database.
            gofmp15

            Do what philmodjunk said and to transfer a copy of the data to your field

             

            Use a script step:  set field x to field y in table other

             

            or make that a calculated field, one of the three options, field x = field y

            • 3. Re: Accessing a field in a different file/database.
              beverly

              "Context" is important to FileMaker and what it can and cannot "see/use" is important. The method of adding the "external" file to the Relationship Graph (RG) is important for related fields, lookups, and ExecuteSQL().

               

              If you do NOT wish to do this, you may pass values with Script Parameter to an external script in the other file/database. Not as elegant as the RG methods, but doable. You must have the script IN the other file/database to call it. And you must capture the parameter:

              Get ( ScriptParameter )

              Perform Script

              (follow the links on this page, too!)

               

              Beverly