Synatic processes one record at a time through a flow. Sometimes, a record may have an array as one of its properties.
The concept of using a ForEach step is to cycle through and process each element in a record array.
An array is a set of values, which are termed elements, that are logically related to each other. For example, an array may consist of the number of students in each grade in a school, and each element of the array is the number of students in a single grade.
Arrays are variables that can store more than one value.
The basic one-dimensional array can be likened to a string because strings contain several values (i.e., characters).
Arrays in two dimensions can be likened to a matrix or a table.
An array in three dimensions can be likened to a cube.
In Synatic, the ForEach step provides this function and generally allows the program to cycle through and process each element in a record array.
Using the ForEach Step
The ForEach step is located in the Control drawer in the Steps palette. To use a ForEach step:
Select and drag the step to the desired location in the flow.
Now add another step to process each element.
Configuring the ForEach Step
Each ForEach Step lets you add a name and a description for the object.
When you add a ForEach step, you can insert another step and configure it to process the elements of an array.
Example
As a typical example, you may use the ForEach step to populate a Google calendar from a source list that contains Tasks and due dates.
A typical type of record for this step would look as follows:
{
"projectName": "Docs",
"projectOwner": "John",
"tasks": [
{"taskName":"Create styles","dueDate":"2020-11-30"},
{"taskName":"Write intro","dueDate":"2020-12-03"},
{"taskName":"Draw diagram","dueDate":"2020-12-05"}
]
}
Options
None.
Advanced Mode Options
None.
Limitations and known issues
None.
See Also
Read about other Flow steps.
Useful Tutorials
Revisit the Getting Started page for a refresher.
Read more about Flow Steps here.