Loop Data Block
You can use this block when you want to do looping through data.
Loop Through
Select which data that you want to loop, you can select between the table, numbers, google sheets, elements, variable, or custom.
When using the custom data option, make sure you write array data type with JSON syntax.
Example
["one", "two", 3, 4, { "key": "value" }]
And when you select the elements
options, Automa will return an array of selectors of the elements that match the selector
you inputted. And you can use the loop data block like below.
Loop ID
ID to identify the loop. Use this ID when referencing data of the loop or when using the loop breakpoint block.
Max data
Set the limit of data to loop.
Accessing data
After you input the data that you want to loop, data of the current iteration of the loop will be available to the blocks after it.
And you can access this data by using the mustache tag inside an input of a block, e.g. {{ loopData@loopId }}
. Replace the loopId
with the id of the loop. If the data is an object,
{
name: 'Foo',
nested: {
name: 'Bar'
}
}
to access the value of it you can use {{ loopData@loopId.path }}
syntax where the path
is the dot notation of the object. For example:
{{ loopData@loopId.name }}
=>Foo
{{ loopData@loopId.nested.name }}
=>Bar
Read more: reference data
Loop Index
To access the index of the loop, use the {{ loopData@loopId.$index }}
syntax.
Breakpoint
To make the loop data block work as intended, you need to add a breakpoint for the loop using the loop breakpoint block. With this breakpoint, the workflow can know where to start over the loop.