Control Flow Activities: For Each

Control Flow Activities: For Each

For Each

The For Each activity allows you to iterate over a list of items and process each item in turn. 

image

After opening the 'If' activity, you will get the below configuration panel. 

image

Default Configuration Parameters

Field

Description

Each Item

Single data of results.

Result Set

The data to be iterated.

Sample For Each Activity

  • 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:

  1. {

  2.          "page":1,"per_page":3,"total":12,"total_pages":4,"data":[

  3.          {"id":1,"name":"cerulean","year":2000,"color":"#98B2D1","pantone_value":"15-4020"},

  4.          {"id":2,"name":"fuchsia rose","year":2001,"color":"#C74375","pantone_value":"17-2031"},

  5.          {"id":3,"name":"true red","year":2002,"color":"#BF1932","pantone_value":"19-1664"}
  6.          ]
  7. }

  • 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:

image

  • 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.

image

  • 'After Each' button will contain single data of 'Result Set'.
  • 'On Finish' button activity will execute when the iteration of data is completed.

    Still can’t find an answer?
      • Related Articles

      • Control Flow Activities: Stop Workflow

        Stop Workflow control flow The ‘Stop Workflow’ Activity allows you to stop the execution of the current executing workflow. After opening the 'Stop Workflow' activity, you will see the configuration panel as shown below. You don't need to configure ...
      • Control Flow Activities: Phone Number Parsing

        Phone Number Parsing control flow The ‘Phone Number Parsing' Activity provides the ability to format any phone number according to the selected ‘Phone format’ type and 'Country region code’ (optional). After opening the 'Phone Number Parsing' ...
      • Control Flow Activities: If

        If The 'If' Activity allows you to check the data is valid, invalid, less than, more than, etc. using the conditions. If the Property matched the conditions then it will execute the THEN button activities else it will execute the ELSE button ...
      • Control Flow Activities:Switch

        Switch Statement The 'Switch' Activity is used to identify unique branches of the selected data source. This allows for a single data source to have unique chains of Activities for every different type of values. For example, a single data source ...
      • Common Control Flow Uses

        5. Control Flows Activities The activities listed under Control Flows are commonly used in PopFlow. These activities allow you to create more complex and conditional workflows. These control flows enable the automation to make decisions and take ...