List.HasValue
-------------

Checks whether a list contains a given value.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [List](component_List.md) | [6.4](newinversion64.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "List.HasValue"; List; Value ) 

**MBS**( **"List.HasValue";** /\* Checks whether a list contains a given value. \*/  
**$List**; /\* The list to process.e.g. "Hello" ¶ "" ¶ "World" \*/   
**$Value**) /\* The value to check.e.g. "Hello" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| List | The list to process. | "Hello" ¶ "" ¶ "World" |
| Value | The value to check. | "Hello" |

### Result

Returns 1, 0 or error.

### Description

Checks whether a list contains a given value.  
Returns 1 if value is found or 0 if not. Text comparison is case sensitive.  
### Examples

Check if value is in list:

 MBS ( "List.HasValue"; "1¶2¶3"; "2" )  
Print what user selected:

 # Show dialog to select something   
Set Variable \[$r ; Value:MBS ("[ListDialog.ClearList](ListDialogClearList.md)")\]  
Set Variable \[$r ; Value:MBS ("[ListDialog.SetPrompt](ListDialogSetPrompt.md)"; "Please select items to print:")\]  
\# We use tags as the visible titles may be localized.   
Set Variable \[$r ; Value:MBS ("[ListDialog.AddItemToList](ListDialogAddItemToList.md)"; "Werbung¶Angebot¶Rechnung¶Erinnerung"; "Flyer¶Offer¶Invoice¶Reminder")\]  
Set Variable \[$r ; Value:MBS ("[ListDialog.SetAllowMultipleSelection](ListDialogSetAllowMultipleSelection.md)"; 1)\]  
Set Variable \[$r ; Value:MBS ("[ListDialog.SetSelectedTitle](ListDialogSetSelectedTitle.md)"; "Offer")\]  
\# Show dialog   
Set Variable \[$r ; Value:MBS ("[ListDialog.ShowDialog](ListDialogShowDialog.md)")\]  
\# now do things   
Set Variable \[$selected ; Value:MBS ("[ListDialog.GetSelectedTag](ListDialogGetSelectedTag.md)")\]  
If \[MBS ("List.HasValue"; $selected ; "Flyer")\]  
 # print flyer  
End If  
If \[MBS ("List.HasValue"; $selected ; "Invoice")\]  
 # print invoice  
End If  
If \[MBS ("List.HasValue"; $selected ; "Offer")\]  
 # print offer  
End If  
If \[MBS ("List.HasValue"; $selected ; "Reminder")\]  
 # print reminder  
End If  
### See also

- [List.AddValue](ListAddValue.md)
- [List.SetValue](ListSetValue.md)
- [ListDialog.AddItemToList](ListDialogAddItemToList.md)
- [ListDialog.ClearList](ListDialogClearList.md)
- [ListDialog.GetSelectedTag](ListDialogGetSelectedTag.md)
- [ListDialog.SetAllowMultipleSelection](ListDialogSetAllowMultipleSelection.md)
- [ListDialog.SetPrompt](ListDialogSetPrompt.md)
- [ListDialog.SetSelectedTitle](ListDialogSetSelectedTitle.md)
- [QuickList.HasValue](QuickListHasValue.md)
- [QuickList.HasValues](QuickListHasValues.md)

### Release notes

- **Version 14.2**
    - Added [QuickList.HasValues](https://www.mbsplugins.eu/QuickListHasValues.shtml) and [Dictionary.HasKeys](https://www.mbsplugins.eu/DictionaryHasKeys.shtml) functions.

### Blog Entries

- [MBS FileMaker Plugin, version 6.4pr8](https://www.mbsplugins.de/archive/2016-09-19/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 16th September 2016 , last changed 16th September 2016

  
[List.HasDuplicateItems](ListHasDuplicateItems.md) - [List.IndexOfFirstValueMatching](ListIndexOfFirstValueMatching.md)

[HTML Version](ListHasValue.shtml)