OVERVIEW:
The ForEach activity allows you to iterate over a list of items and process each item in turn.
Default Configuration Parameters:
- Each Item: single data of Results.
- Result Set: The data to be iterate.
HOW IT WORKS:
A Simple Example to configure the 'For Each' activity in PopFlow Studio.
- To configure a 'For Each' activity first you need to get the data from 'GET Activity', 'HTTPS Activity' or from any other source.
- Once you get the data you can iterate on that data by using the 'For Each ' activity.
- As an example of how this might be used. Assume you make an HTTP request that returns the following data:
{
"page":1,"per_page":3,"total":12,"total_pages":4,"data":[
{"id":1,"name":"cerulean","year":2000,"color":"#98B2D1","pantone_value":"15-4020"},
{"id":2,"name":"fuchsia rose","year":2001,"color":"#C74375","pantone_value":"17-2031"},
{"id":3,"name":"true red","year":2002,"color":"#BF1932","pantone_value":"19-1664"}
]
}
- The brackets [ ] highlighted in red above indicate that this a list of items.
- You can use the 'ForEach' activity to iterate through the list as shown in the following example:
- After filling the values in the given fields you can close and save the activity by clicking outside of the activity.
- You will notice two child buttons under the 'For Each' Activity.
- 'After Each' button will contain single data of 'Result Set'.
- 'On Finish' button activity will execute when the iteration of data is completed.