Dictionary.Create
-----------------

Creates a new dictionary.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Dictionary](component_Dictionary.md) | [5.0](newinversion50.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Dictionary.Create" { ; Key; Value... } ) 

**MBS**( **"Dictionary.Create";** /\* Creates a new dictionary. \*/  
**$Key**; /\* Optional; Optional, a key. \*/   
**$Value...**) /\* Optional; Optional, a value. \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Key | Optional, a key. |  | Optional |
| Value... | Optional, a value. |  | Optional |

### Result

Returns dictionary reference number or error.

### Description

Creates a new dictionary.  
Dictionaries are hash maps, so lookup is very fast (often faster than search in your FileMaker database). You can use them for storing parameters or lookup tables.  
Optionally you can pass keys and values as parameters to this function.  
  
If you looked for associative arrays, you are right here.  
  
Dictionaries can have multiple million of entries without problems. Just be aware of FileMaker's standard loop/recursion limit of 50000, which can be raised with SetRecursion function.  
  
This function takes variable number of parameters. Pass as much parameters as needed separated by the semicolon in FileMaker.  
Please repeat Value parameter as often as you need.  
### Examples

Build a dictionary in a calculation:

 Let ( \[  
/\*  
Create new Dictionary  
\*/  
 param = MBS ( "Dictionary.Create" );  
  
/\*  
 Fill in parameters  
\*/   
 r1 = MBS ( "[Dictionary.SetValueForKey](DictionarySetValueForKey.md)"; param; "text"; Pass Parameters with Dictionary::TextField );  
 r2 = MBS ( "[Dictionary.SetValueForKey](DictionarySetValueForKey.md)"; param; "number"; Pass Parameters with Dictionary::NumberField );  
 r3 = MBS ( "[Dictionary.SetValueForKey](DictionarySetValueForKey.md)"; param; "date"; Pass Parameters with Dictionary::DateField );  
 r4 = MBS ( "[Dictionary.SetValueForKey](DictionarySetValueForKey.md)"; param; "time"; Pass Parameters with Dictionary::TimeField );  
 r5 = MBS ( "[Dictionary.SetValueForKey](DictionarySetValueForKey.md)"; param; "timestamp"; Pass Parameters with Dictionary::TimeStampField );  
 r6 = MBS ( "[Dictionary.SetValueForKey](DictionarySetValueForKey.md)"; param; "container"; Pass Parameters with Dictionary::ContainerField )  
/\*  
 return dictionary  
\*/  
 \] ; param )  
Build a dictionary with given Keys and Values:

 MBS ("Dictionary.Create"; "FirstName"; $FirstName ; "LastName"; $LastName ; "City"; $City ; "Phone"; $Phone ; "Email"; $Email )  
Test script to look for duplicate UUIDs:

 Set Variable \[ $dic ; Value: MBS ( "Dictionary.Create") \]   
Loop  
 Set Variable \[ $uuid ; Value: Get(UUID) \]   
 If \[ MBS ("[Dictionary.HasKey](DictionaryHasKey.md)"; $dic ; $uuid ) \]   
 Show Custom Dialog \[ "Duplicate!" ; $uuid \]   
 Exit Loop If \[ 1 \]   
 End If  
 Set Variable \[ $r ; Value: MBS ( "[Dictionary.SetValueForKey](DictionarySetValueForKey.md)"; $dic ; $uuid ; $uuid ) \]   
End Loop  
Set Field \[ test::test ; MBS ( "[Dictionary.Keys](DictionaryKeys.md)"; $dic ) \]   
Set Variable \[ $r ; Value: MBS ( "[Dictionary.Release](DictionaryRelease.md)"; $dic ) \]  
### See also

- [Dictionary.Count](DictionaryCount.md)
- [Dictionary.CreateNamed](DictionaryCreateNamed.md)
- [Dictionary.KeysWithPostfix](DictionaryKeysWithPostfix.md)
- [Dictionary.KeysWithPrefix](DictionaryKeysWithPrefix.md)
- [Dictionary.Serialize](DictionarySerialize.md)
- [Dictionary.SetValueForKey](DictionarySetValueForKey.md)
- [Dictionary.ToJSON](DictionaryToJSON.md)
- [Dictionary.ToMatrix](DictionaryToMatrix.md)
- [Dictionary.ToText](DictionaryToText.md)
- [Dictionary.ToXML](DictionaryToXML.md)

### Release notes

- **Version 8.1**
    - Added [Dictionary.CreateNamed](http://www.mbsplugins.eu/DictionaryCreateNamed.shtml) function.

### Example Databases

- [Dictionary/Dictionary Container Test](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Dictionary/Dictionary%20Container%20Test.shtml#2ScriptAnchor_)
- [Dictionary/Pass Parameters with Dictionary](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Dictionary/Pass%20Parameters%20with%20Dictionary.shtml#1Button47.0000000315.000000073.0000000498.0000000LayoutObjectAnchor_)

### Blog Entries

- [MBS FileMaker Advent calendar - Door 23 - Dictionary](https://www.mbsplugins.de/archive/2025-12-23/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [Data structures in MBS Plugin](https://www.mbsplugins.de/archive/2023-11-27/Data_structures_in_MBS_Plugin/monkeybreadsoftware_blog_filemaker)
- [Data structures in FileMaker with MBS Plugins](https://www.mbsplugins.de/archive/2017-10-19/Data_structures_in_FileMaker_w/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 5.1 for OS X/Windows](https://www.mbsplugins.de/archive/2015-05-19/MBS_FileMaker_Plugin_51_for_OS/monkeybreadsoftware_blog_filemaker)
- [Passing parameters via dictionary functions](https://www.mbsplugins.de/archive/2015-03-17/Passing_parameters_via_diction/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 3/2025, Seite 22](https://filemaker-magazin.de/neuigkeit/4290-Appetithappen-FMM_202503)

This function checks for a license.

Created 12nd December 2014 , last changed 2nd November 2021

  
[Dictionary.Count](DictionaryCount.md) - [Dictionary.CreateNamed](DictionaryCreateNamed.md)

[HTML Version](DictionaryCreate.shtml)