D
D
Developers
Search…
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:
1
{[ map [statement] into [key] [value] ]}
2
Body, optionally using {{ key }} and {{ value }}
3
{[/]}
Copied!
With the following required attributes:
  • key - the newly created property where the iterated key is stored
  • value - the newly created property where iterated value is stored
  • statement - 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:
1
{
2
"attributes": {
3
"Stamina": "10",
4
"Agility": "20",
5
"Intelligence": "9001"
6
}
7
}
Copied!
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:
1
<h1>Player stats</h1>
2
<ul>
3
{[ map attributes to attributeName attributeValue ]}
4
<li>{{ attributeName }}: ({{ attributeValue }})</li>
5
{[/]}
6
</ul>
Copied!
With each iteration, data in both attributeName and attributeValue is different, resulting in the following output:
1
<h1>Player stats</h1>
2
<ul>
3
<li>Stamina: 10</li>
4
<li>Agility: 20</li>
5
<li>Intelligence: 9001</li>
6
</ul>
Copied!
Last modified 7mo ago
Copy link
Contents
Syntax