Loop array block
Purpose
Iterate through a list of items while duplicating a component and its children for each item in the list.
Input
- Array A list of items.
Output
-
Component (mandatory)
The desired component to be duplicated. Typically a container with labels and sometimes other containers. -
Index The index number of the item in the list. Starts from 0. This will output a new number for every item in the list.
-
Item Will output an object for each item in the list.
Example
I have a list of x items. I want to number each items with an index number and retrieve first name & last name with two get data
blocks. The get data
blocks connect to two individual labels. All three labels are placed inside the repeated container.
graph LR A([List]) --> L(Loop array) L --Component--> B(Container) L --Index--> C(Label) L --Item--> D(Get data) L --Item--> E(Get data)
Caveats
-
Everything created (first time )after the loop is no longer
-
For external manipulation of looped elements.
The trigger that pushes data to the looped element (usually the array), must be connected after the ‘loop array block’ is fed data. -
Index
0
is often treated as a false value when passed to other blocks.