Skip to main content

Using ForEach Activity

For Each is used to iterate through the collection of items such as an array, data tables, lists, or the elements for a specified number of times. It will loop through the collection, and each time through the loop, it will use the next item from the collection. It starts with the first item in the array (the one at index 0) and continues through to the last item in the array.

Let us understand For Each activity with an example process. Here is an example that takes a list of numbers and displays the count, sum of even, and odd numbers as output.

Come, let's create this process in Process Designer:


Launch and create a new process in Process Designer

  • Launch Process Designer from the Windows Start menu located under IntelliBuddies Enterprise


Create New Process

  • Click on New Process and fill in the new process details


  • Add array variable to hold the list of numbers.
  • Int32 variables to hold count and sum for even and odd numbers.


  • Add For Each by setting type as Int32.
  • Iterate through the integer array to get number.


  • Add If Else by setting the condition to check whether numbers are even.
  • In order to check for even number, compute remainder by divinding each number by 2 and see it is 0.
  • Assign computed values using Multi Assign activity.



Save the process

  • From the Design tab ribbon, click on Save


Run the process

  • From the Design tab ribbon, click on Run


Ensure the process executes and displays the count and sum of even and odd numbers in the given array.

Download Example (C#)