Using variables
In FileMaker Pro, you can use variables:
 •
 •
 •
 •
 •
Variables add flexibility and portability to your database, and can be used instead of global fields in your database schema.
Using the Set Variable script step or the Let function, you can create local and global variables. The scope of local and global variables is limited to the current file.
 •
A local variable can only be used in script steps in the currently executing script. The value in a local variable is cleared when the script exits. Local variables are prefixed with $.
 •
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. Prefix global variables with $$.
 •
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.
Anywhere that you specify a path to a file or folder, you can use variables separated by "/", ":", or carriage return.
Variables let you specify file or folder paths dynamically in the following script steps:
 •
 •
 •
 •
 •
 •
 •
 •
 •
 •
 •
 •
 •
 •
 •
 •
Examples of using variables in file paths
Assume the following variables:
$fileName = "test.xlsx"
$username = "JohnSmith"
$searchList = "file:old results.txt
     file:../archived/old results.txt"
 
Specify one or more directories in a path
Specify one or more complete paths
file:old results.txt
file:../archived/old results.txt
Notes
 •
 •
 •
 •