Skip to main content
Skip table of contents

Map

A Map contains values associated with keys. Each value in the Map can be accessed by its key and a typical example of Map use in Dynamo is Salesforce query results, which, while actually Data item values, behave like Maps with the record field names as keys and the field values as the values. Use an expression like ${map.key} to get the value behind a key.

All the keys of a Map are always String-type values, but the value can be of any type - even another Map, adding another data structure layer - regardless of the types of other values in the Map. It is generally up to the logic using Maps to know what kind of values are hidden behind the keys.      

Related commands

  • setMap & addMapEntry
    These commands can be used to create Maps within the logic, or modify existing Maps.

Methods

containsKey(value)

Resolves into a Boolean telling whether the Map contains the specified key (true) or not (false).

For example, the expression ${userProperties.containsKey("Address")} can be used to check if 'userProperties' contains a key called "Address".

isEmpty()

Resolves into a Boolean telling whether the Map contains no entries (true) or has one or more entries (false).

For example, the expression ${users.isEmpty()} resolves into true if the 'users' Map contains no entries.

Using the shorthand form the expression becomes ${users.empty}. Additionally, the EL-operator empty also works in a similar manner to this method, so the expression could be also written as ${empty users}.

keySet()

Resolves into a Collection that contains all the keys of the Map. Useful if you'd like to loop through all the entries of a Map, as with the key you can also easily get the matching value.

For example, the expression ${data.keySet()} could be used with the forEach tag to inspect the contents of the 'data' Map.

size()

Resolves into a Number representing the amount of key-value pairs in the Map.

For example, the expression ${editorConfig.size()} resolves into the number of entries in the 'editorConfig' Map.

values()

Resolves into a Collection that contains all the values of the Map. Do note that getting the matching key for any of the values in the Collection is not possible.

This method should be used with care, as Maps often contain different kinds of values behind their keys. It is highly recommended to only use this method on Maps constructed within the logic, all containing similar kinds of values.

For example, the expression ${aMapOfMaps.values()} could be used with the forEach tag to inspect all the values of the 'aMapOfMaps' Map.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.