Variable.Lookup
---------------

Retrieves the value of named variable that was declared using [Variable.Set](VariableSet.md).

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Variable](component_Variable.md) | [12.3](newinversion123.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Variable.Lookup"; Name { ; DefaultValue } ) 

**MBS**( **"Variable.Lookup";** /\* Retrieves the value of named variable that was declared using Variable.Set. \*/  
**$Name**; /\* The Name of the variable \*/   
**$DefaultValue**) /\* Optional; The default value to return if variable doesn't exist. \*/ 

(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](VariableSet.md).  
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](VariableExists.md) whether a variable exists.  
### Examples

Try it:

 "Set: " &amp; MBS ("[Variable.Set](VariableSet.md)"; "test"; "test") &amp; ¶ &amp;  
"Lookup test: " &amp; MBS ("Variable.Lookup"; "test"; "not found?") &amp; ¶ &amp;  
"Lookup test2: " &amp; MBS ("Variable.Lookup"; "test2"; "not found?")  
<small>  
Example result:   
Set: OK  
Lookup test: test  
Lookup test2: not found?</small>### See also

- [Variable.Exists](VariableExists.md)
- [Variable.Get](VariableGet.md)
- [Variable.Set](VariableSet.md)

### Blog Entries

- [MBS FileMaker Plugin 12.3](https://www.mbsplugins.de/archive/2022-07-19/MBS_FileMaker_Plugin_123/monkeybreadsoftware_blog_filemaker)
- [Neues MBS Plugin 12.3 für Claris FileMaker](https://www.mbsplugins.de/archive/2022-07-12/Neues_MBS_Plugin_123_für_Clar/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin 12.3 for Claris FileMaker](https://www.mbsplugins.de/archive/2022-07-12/MBS_Plugin_123_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 12.3pr2](https://www.mbsplugins.de/archive/2022-06-06/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

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

  
[Variable.List](VariableList.md) - [Variable.Names](VariableNames.md)

[HTML Version](VariableLookup.shtml)