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

FM.VariableLookup

Retrieves the value of named variable that was declared using FM.VariableSet.

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

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 FM.VariableSet.
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 FM.VariableExists whether a variable exists.

Examples

Try it:

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

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

See also

Release notes

Blog Entries

This function checks for a license.

Created 2nd June 2022, last changed 31st January 2023


FM.VariableList - FM.VariableNames