From Dwayne Wright PMP, PMI-ACP, CSM
Certified FileMaker Developer
Well, I’m not going to even try to cover all the power and flexibility of the Set Variable script step here. It could almost be a topic that could be it’s own small book or regularly update blog.
This powerful addition to FileMaker 8 allows you to set a name, a value and a repetition to the computers internal memory.
You have two choice of a local variable and a global variable. Each has it’s own unique advantages and drawbacks. I’d have to say the local variable is probably more commonly used simply because FileMaker will define a variable as local by default.
A local variable is defined by adding a single dollar sign in it’s name such as $InvoiceNumber, $ClientID or $Counter. A local variable will store it’s information within a script while that script is running. After the script is finished in it’s execution, the defined local variable will have no value. An advantage of this is like a disposable lighter. When you are done, you throw it away because you never intend to refill it.
A global variable is defined by adding a two dollar sign characters in it’s name such as $$InvoiceRange, $$Array or $$UserPrefs. A global variable will store it’s information within the entire file while the file is open. This way it can be used across scripts or even in-between times that scripts are called upon.
As much as you might think that a global variable would be available from two different FileMaker files during the same session, that is NOT the case. In order to pass data like that between different files, you will need to use global fields or a script result.
Move Portal Row Data Via Variables is a post that includes a real world example of script variable.
More info about the author and FileMaker in general, contact me at firstname.lastname@example.org.
© 2007 - Dwayne Wright - dwaynewright.com
The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.