2 Replies Latest reply on Nov 16, 2010 9:08 AM by Marty1

    Global fields as data holders

    Marty1

      Title

      Global fields as data holders

      Post

      Hi,

      I am having an issue to search data between various databases and layouts. In database 'products' I can list all products and select one, say "part_num". I have tried various 'set field' and other methods to then go into another data base 'Invoice_lines' and display all invoice lines that contain that part number. I have tried to evaluate the ERD relationships, they seem fine, but I can not get this to function correctly. The only method I have found to work is using a script like:

      Insert Calculated Result [Select; Globals::number; Products::part_num]

      Goto layout ["customers"(Invoices_customers) ] 

      {there is a relationship between 'invoice_customers' and 'Invoice_Lines'}

      Enter find mode []

      Set Field [Invoice_lines::prod_num; globals::number]

      Perform Find []

      My question is; is this an acceptable method to transfer data between databases for search and manipulation purposes?, what issues are there using this method and any thoughts as to why I could not just jump between databases and search the product numbers.

      appreciate your assistance

      Best regards

      Marty

        • 1. Re: Global fields as data holders
          philmodjunk

          Instead of

          Insert Calculated Result [Select; Globals::number; Products::part_num]

          use

          Set Field [Globals::number; Products::part_num]

          Insert requires that the target field be present on the current layout while Set Field does not.

          You can actually move data several different ways between your two tables:

          1. A global field like you describe is one.
          2. You can also use Set Variable and store the info in a variable
          3. You can also pass the information in a script parameter

           

          All are slightly different ways of putting your data in  a "bucket" so that you can carry it to a different record than the record that was originally current.

          Thus, these are common ways to move data around when you switch to a different record and/or to a layout that refers to a different table occurrence (show records from in Layout setup...).

          "why I could not just jump between databases and search the product numbers?"

          Filemaker evaluates references to tables and fields from the context of the current record of the current layout. When you switch layouts, you may now have a different current record from a different table. Before you changed layouts, a reference to Products::part_num referred to the part_num field of the current record. After you switched, it refers to the part_num field of the first record that is already related to your current Invoice_lines record and this may well be a completely different record or such a related record may not even exist.

          • 2. Re: Global fields as data holders
            Marty1

            Great, many thanks the situation is much clearer. Superb description.

            Ohh to know a snippet of your Filemaker knowledge.

            regards

            Marty