Variable

What is a variable in FileMaker?

A variable in FileMaker databases is an element in the Calculation or Script Editor that can be used to temporarily store data. A variable is identified by the dollar sign $. FileMaker distinguishes between local and global variables, with local variables being identified by one dollar sign ($variable) and global variables by two dollar signs ($$variable). Variables are extremely flexible and can store nearly all field contents, including container fields.

Add new variable in a script

To add a new variable in a FileMaker script, add the command Set Variable [] to your script, which you can find in the [Control] area.

Set options for variable

Enter a name for your variable under [Name] and define the variable as either local or global. Enter any value for the variable under [Value]. Click the [Specify…] button to open the formula editor. Under [Repetition] you can optionally define the number of repetitions for the new variable.

Add new variable in a formula

In a calculation, you can add variables with the FileMaker command let. The syntax of this command is as follows:

let ( { [ } Var1 = expression1 {; Var2 = expression2... ]} ; arithmetic statement )

Parameters

  • Var – any Variablesname, local variable name or global variable name (see guidelines for naming variables under Naming fields)
  • expression – any calculationexpression, field or constant
  • calculation statement – any arithmetic expression, field or constant
Parameters in curly brackets { } are optional.
example: SetzenVar ( x=5 ; x*x ) returns 25.

Use variables in path specifications

Variables can be used very well in path specifications, as they can be set up for example in the script command [Import Records].

Specify variable as file path

In these dialog boxes, FileMaker supports specifying files as variables, which allows you to calculate dynamic filenames for importing data.

Related entries

Diesen Beitrag bewerten:

About Author

Markus Schall
Development of FileMaker databases since 1994, modification and extension of FileMaker solutions, conversion of FileMaker databases from .fm, .fp3, .fp5 (FileMaker 2-6) or .fp7 (FileMaker 7-11) to .fmp12 (FileMaker 12-17), interfaces to third-party systems such as online shops, CMS or other databases. Development of individual FileMaker database systems based on the gFM business framework with personal advice from Oldenburg. Operator of the online specialist portal goFileMaker.de, developer of the CRM and merchandise management system gFM-Business. Member of FileMaker Business Alliance, FileMaker Developers Subscription and FMM Expert. Winner of an FMM Award 2011, awarded by the FileMaker Magazine.