You are here: Using BML > Functions & Scripts > Dictionaries



Dictionaries are used to store key value pairs. Their purpose is similar to that of an array or Data Table. A dictionary key is used to loop up a value. Dictionaries allow users to store and retrieve data quickly and easily. Once you have created a dictionary, values are stored using a key. You can attach a value with any data type to a dictionary, except another dictionary. When you declare a dictionary, ensure to declare what data type is needed.



This is a dictionary function that checks to see if the key is found in the dictionary.

Syntax: containskey(dictIdentifier, key)


Return Type: Boolean

Example of containskey():


This function is used to create a dictionary of a specific data type, which is specified by the dictType parameter.

Syntax: dict(dictType)


Return Type: Boolean


This function retrieves the value of the provided key from the dictionary.

Syntax: get(dictIdentifier, key)


Return Type:The return type is based on the dictionary data type

Example of get():

Below, three separate keys and values have been defined and placed within the same dictionary.


Use this function to retrieve an unordered String Array of all keys found within a Dictionary. If the Dictionary does not contain any keys, an empty array is returned.

Syntax: keys(Dictionary dictionaryIdentifier)

Return Type: All keys will be cast as a String and returned in an array in no particular order.

Example of keys():

d= dict("string");

put(d, "1", "string1");

put(d, "2", "string2");

put(d, 1, "string3");

put(d, 2, "string4");

return keys(d);

This function will return a string array with 4 string elements.


Once a dictionary has been created, you can define keys and values to put into the dictionary.

Syntax: put(dictIdentifier, key, value)


# Parameter Data Type Description
1 dictIdentifier Dictionary Identifies the dictionary you are adding values to.
2 key String, Integer, or Float Unique identifier for the value parameter.
3 value String, Integer, or Float Data value that relates to the unique key identifier.

Return Type: Boolean

Example of put():



Related Topics Link IconSee Also