5 Replies Latest reply on Feb 20, 2014 7:39 AM by TSGal

    Global variables

    KimFritzbøger

      Summary

      Global variables

      Product

      FileMaker Pro

      Version

      13

      Operating system version

      Win7

      Description of the issue

      How to use Global variables and Custom funktions in a script
      Can't figure out how to "Get" values from a variable or a funktion within a script
      Proberbly because i'm a newbie
      An example would be nice :-)

      Kim

        • 1. Re: Global variables
          philmodjunk

               Report An Issue is intended for Reporting Possible Software bugs. Questions on how to work with FileMaker Pro should be posted in the FM Pro Forum Section. (See tab at top of this screen.)

               Any expression that uses a calculation, set field, set variable, If, just to name a few can use a calculation that includes a call to a custom function.

               Example from one of my scripts:

               If [ ValidUPC ( MyTable::BarCodeField ) ]
                  Do code if UPC is valid
               Else
                  Do Code to scan again or manually enter code if UPC is not valid
               End IF

               ValidUPC is one of my custom functions. (It validates a Universal Product Code when I use my iPhone to scan a product bar code.)

               Global variables can be referenced in exactly the same scripts steps where you can reference a custom function.

               Many of my script trigger controlled scripts check the value of a global field named $$TriggersOff

               If [ Not $$TriggersOff ]
                 Rest of script goes here
               End IF

               That allows me to use other scripts to set $$TriggersOff to true when I want to disable the trigger controlled scripts.

          • 2. Re: Global variables
            KimFritzbøger

                 Okay

                 You are setting some triggers

                 My problem is a global variable is set to either 1 2 3 or 4

                 Now i want to in a script to do different actions based on the value of this global variable.

                 I'm in transision from Access and find the script making very limited because one has to klik on a funktion

                 The funktion get value isn't a option and that stalls me :-)

                 Thank you for very quick answer

            • 3. Re: Global variables
              TSGal

                   Kim Fritzbeger:

                   Thank you for your posts.

                   Here are the steps to evaluate for the different values of the variable:

                   If [ $variable = "1" ]
                      <perform some actions>
                   Else If [ $variable = "2" ]
                      <perform another set of actions>
                   Else If [ $variable = "3" ]
                      <perform a third set of actions>
                   Else If [ $variable = "4" ]
                      <perform a fourth set of actions>
                   Else
                      <optional set of actions, or just omit "Else">
                   End If

                   -----

                   Let me know if you need additional clarification.

                   TSGal
                   FileMaker, Inc.

              • 4. Re: Global variables
                KimFritzbøger

                     Okay

                     I'm persisten :-)

                     What if i don't know the value of the variable ?

                     I want to "get" the value and copy use it elswhere

                     fx copy the value into a field/record

                • 5. Re: Global variables
                  TSGal

                       Kim Fritzbeger:

                       Set Field [ <field name> ; <variable name> ]

                       TSGal
                       FileMaker, Inc.