A map is similar to a list that contains multiple values, but contrary to a list it is not ordered. Instead, the items of a map can be accessed with a key, which is stored alongside each value in the map. In other words: keys are mapped to values, which is where the name "map" comes from.
Keys and values can be of any type, so long as all keys have the same type and all values also have the same type.
It is not yet possible to create maps in rules, but you can use the maps that already exist in your configurator.
These components have maps that you can work with:
- Graphic component has two maps: visuals and dynamic visuals
- Resource component has a resource map
- Checkout component has a shops map
There are two more maps in every configurator:
- The configurator has a components map
- presets.All is a map of all your presets
|gets the number of items in the map
|gets the value for a specified key
Returns the number of items in the map.
|gets the number of components in your configurator
Returns the value for a specified key, or empty if the map contains no such key.
|get a resource by name
When looking for keys, get uses the default equality operator as defined by the type of the keys in the map.
All pre-defined maps have text keys, which are compared case-sensitive.