Set Variable
Sets a local or global variable to a specified value.
Set Variable [<variable name> {[<repetition number>]}; Value:<value or formula>]
Click Specify to set the variable options:
Name is the name of the variable you want to create. Prefix the name with $ for a local variable or $$ for a global variable. If no prefix is added, $ is automatically added to the beginning of the name.
Value is the value the variable is set to. You can enter text or specify a calculation.
Repetition is the repetition (index) number of the variable you want to create. If no repetition is specified, the default is 1.
This script step is also supported in web publishing and in a FileMaker Server scheduled script.
Originated in 
FileMaker Pro 6.0 or earlier
If a variable doesn’t exist, this script step will create one. A variable name has the same naming restrictions as a field name. For more information, see About naming fields.
Local and global variables can be created and used in calculations.
A global variable can be used in a calculation or script anywhere in a file, for example, other scripts or file paths. The value of a global variable is not cleared until the file is closed.
Local and global variables (or even two local variables in different scripts) can have the same name but they are treated as different variables and can store different values.
The following example sets a local variable.
Set Variable [$commission; Value:.05]
The following example sets a global variable.
Set Variable [$$commission; Value:.1]
The following example sets a global variable at a specified repetition number.
Set Variable [$$bonus[2]; Value:3 * 4]
Related topics 
Script steps reference (alphabetical list)
Script steps reference (category list)
About formulas
Using variables
Defining repeating fields