Creating a solution > Using variables
Using variables
In FileMaker Pro, you can use variables:
in file paths (see Creating file paths)
in scripting (see Set Variable script step)
in calculations (see Let function)
in find requests that you create and edit in the Edit Find Request dialog box (see Specify Find Requests and Edit Find Request dialog boxes)
on layouts as merge variables (see Inserting merge variables onto a layout)
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 and the current user.
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 many script steps, such as the Insert File script step and Import Records script step.
Variables are only supported in script steps that use stored file paths.
Variables are not supported in file paths that are stored in container fields.
Variables are not supported in FileMaker data source references.
The data type of a variable is determined dynamically based on the assigned data. The default data type is text.