6 Replies Latest reply on Mar 18, 2011 11:15 AM by philmodjunk

    Global field may not be global

    yaldir

      Summary

      Global field may not be global

      Product

      FileMaker Pro

      Version

      Pro 11 advanced

      Operating system version

      W 7

      Description of the issue

      I have created a global field and store the information entered via layout. Once entered, scrip is called. In the called script, no matter what I do, I don't see the Global fields value? However when debug the initial script which collects the info initially, it has the value I want.  What causing this? I am stuck.
      regards
      Alp

      Steps to reproduce the problem

      two scripts based on two different files.
      First script has the Global field value (entered and verified. First script calls another script and there, global field value is blank? Regardles of what you do, it is blank.

      Expected result

      I should be able to use the global fields across files?

      Exact text of any error message(s) that appear

      no error message

      Workaround

      none?

        • 1. Re: Global field may not be global
          RickWhitelaw

          If your two scripts are in different files, you should pass the value of the global field in file 1, the file, I assume, which has script 1 and the global field, as a script parameter to script 2 in file 2.

          RW

          • 2. Re: Global field may not be global
            philmodjunk

            Global fields can be referenced across all layouts/tables within a given file, but not across different files. The value would need to be passed in a Script Parameter as Rick describes or you'd need a relationship from File 2 to the table in File 1 (how we did this before script parameters) in order to access the global field. Since the field is global, any relationship that matches to at least one record in the table will make the global field accessible.

            • 3. Re: Global field may not be global
              yaldir

              OK, I was able to pass the value of the global field and script runs fine in file 2. Now that I have the result (global field) which should go back to file one but with no luck.  I even created another script to pass result back to file one but failing. I have tried relating one of the global field to file to still with no luck.

              • 4. Re: Global field may not be global
                philmodjunk

                You do not use the global field in the relationship. You link by some other field in the same table.

                GlobalsTableFromFile1::AnyNonblankfield X CurrentTableInFile2::AnynonblankField

                An alternative is to use Perform Script to perform a script in file1 from File 2 and pass the value back to it via another script parameter. This script can then use Set Field [table::globalfield ; Get (ScripParameter)] to update the global field's value.

                • 5. Re: Global field may not be global
                  yaldir

                  Thank you both! You learn every day...:) I finally got it and it works like a charm.  Incase I need to pass multiple parameters, what would be the syntax for it?

                  One last question, I discovered that one of my value list displays "Part Numbera and a Calc Field" It works just fine but, discovered several Part numbers shows up in value list but when I look at my inventory records, I can find them? Is there a under the cover list refresher? This scares me a bit and I want to make sure what you see on list is what you have in your inventory.

                  best regards

                  Alp

                  • 6. Re: Global field may not be global
                    philmodjunk

                    There are several ways to pass multiple parameters. They all combine the values into a single parameter but use different methods to separate them back out on the other end.

                    My favorite is to use the list function.

                    In the parameter box, enter an expression like this: List ( param1 ; Param2 ; Param3 )

                    Then, at the beginning of my script, I put this code:

                    Set variable [$Param1 ; GetValue ( Get ( ScriptParameter ) ; 1 )
                    Set variable [$Param2 ; GetValue ( Get ( ScriptParameter ) ; 2 )
                    Set variable [$Param3 ; GetValue ( Get ( ScriptParameter ) ; 3 )

                    The only catch is that Param 1 and Param 2 cannot be empty or the parameters misalign in the list.