MenuItem.SetEvaluate
--------------------

Sets expression to be run when menu item is chosen.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Menu](component_Menu.md) | [6.1](newinversion61.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |

MBS( "MenuItem.SetEvaluate"; Item; Expression ) 

**MBS**( **"MenuItem.SetEvaluate";** /\* Sets expression to be run when menu item is chosen. \*/  
**$Item**; /\* The reference to the menu item. Please create one with [MenuItem.CreateMenuItem](MenuItemCreateMenuItem.md) or [MenuItem.CreateSeparator](MenuItemCreateSeparator.md). \*/   
**$Expression**) /\* The expression to evaluate.  
Can be in local language of FileMaker Pro or english.   
For Server must always be in english.e.g. "Let ( $$Done = 1 ; 1 )" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Item | The reference to the menu item. Please create one with [MenuItem.CreateMenuItem](MenuItemCreateMenuItem.md) or [MenuItem.CreateSeparator](MenuItemCreateSeparator.md). | $item |
| Expression | The expression to evaluate.   Can be in local language of FileMaker Pro or english.    For Server must always be in english. | "Let ( $$Done = 1 ; 1 )" |

### Result

Returns OK or error.

### Description

Sets expression to be run when menu item is chosen.  
In the expression the text $$ID$$ will be replaced when evaluated with the hotkey reference, so you can pass it to other functions if needed.  
### See also

- [Menu.SetEvaluate](MenuSetEvaluate.md)
- [MenuItem.CreateMenuItem](MenuItemCreateMenuItem.md)
- [MenuItem.CreateSeparator](MenuItemCreateSeparator.md)
- [MenuItem.GetEvaluate](MenuItemGetEvaluate.md)
- [MenuItem.SetState](MenuItemSetState.md)

### Example Databases

- [Mac and iOS/Data Detector](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/Data%20Detector.shtml#2ScriptAnchor_)

### Blog Entries

- [Formatting and error checking expressions in FileMaker](https://www.mbsplugins.de/archive/2019-12-06/Formatting_and_error_checking_/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 6.1pr5](https://www.mbsplugins.de/archive/2016-03-06/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)
- [Evaluate vs. Script Trigger](https://www.mbsplugins.de/archive/2016-03-04/Evaluate_vs_Script_Trigger/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 2/2021, Seite 28](https://filemaker-magazin.de/neuigkeit/4132-Appetithappen-FMM_202102)

This function is free to use.

Created 4th March 2016 , last changed 27th March 2025

  
[MenuItem.SetEnabled](MenuItemSetEnabled.md) - [MenuItem.SetFontColor](MenuItemSetFontColor.md)

[HTML Version](MenuItemSetEvaluate.shtml)