Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Variable.Lookup

Retrieves the value of named variable that was declared using Variable.Set.

Component Version macOS Windows Linux Server iOS SDK
Variable 12.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Variable.Lookup"; Name { ; DefaultValue } )   More

(old name: FM.VariableLookup)

Parameters

Parameter Description Example Flags
Name The Name of the variable
DefaultValue The default value to return if variable doesn't exist. Optional

Result

Returns OK or error.

Description

Retrieves the value of named variable that was declared using Variable.Set.
This lookup function returns the default value (or empty) if the variable doesn't exist.
Unlike the variables that were introduced in FileMaker 8 these variables are not limited to the File or Script. In other words they can be retrieved from any file in the system regardless of where they were declared.

You can check with Variable.Exists whether a variable exists.

Examples

Try it:

"Set: " & MBS("Variable.Set"; "test"; "test") & ¶ &
"Lookup test: " & MBS("Variable.Lookup"; "test"; "not found?") & ¶ &
"Lookup test2: " & MBS("Variable.Lookup"; "test2"; "not found?")

Example result:
Set: OK
Lookup test: test
Lookup test2: not found?

See also

Blog Entries

This function checks for a license.

Created 2nd June 2022, last changed 16th April 2025


Variable.List - Variable.Names