Map
A map
flow allows a block of code to be executed once for each item in a dictionary. Note that the order of iteration is not guaranteed given the nature of dictionaries. Loops can also contain more nested loops inside them.
In order to iterate over just values or key, use appropriate transformers .keys()
and .values()
on the source dictionary.
If you want to iterate over an array, use for
flow instead.
Syntax
Basic syntax of map
flow is as follows:
With the following required attributes:
key
- the newly created property where the iterated key is storedvalue
- the newly created property where iterated value is storedstatement
- statement to be evaluated to retrieve data for the iterator. Dictionary is expected otherwise an error is thrown
For example, a map
flow be used to create lists, menus, and similar structures from sourced data. Let's assume we have a variable attributes
defined that contains following data:
You can iterate on user data by defining new variables attributeName
and attributeValue
where each key and value of the dictionary get stored in each iteration:
With each iteration, data in both attributeName
and attributeValue
is different, resulting in the following output:
Last updated
Was this helpful?