Add ForEach Loop
- Last UpdatedJun 10, 2024
- 2 minute read
In case, if it is required to iterate through each node of the output XML variable, then we can use the foreach-loop.
In the following example, we will iterate through the output variable @outXmlInfo and log the values of each node.
-
Drag the ForEach-Loop activity from the Engine Activities section to the workflow.

-
Add the connector and add the connector value as 'Success'.

-
Go to the Property window of ForEachLoop. Change the Activity Name, if needed. Assign the XMLIterator which is created above in the last step of database activity. Click Save.
-
Add the logger to log the information of the iterated node values.

-
Add the step event to the connector.
-
Change the properties of the logger. Add Logtype as 'Information'. Click on the LogMessage icon to get the editor below.
-
Select XML variables, iterator and variable. Click on the Update button.
-
Save the Logger workflow.
-
For foreach loop workflow, we need to have a 'Next Loop' activity to go to the next node in the XML variable. Add the NextLoop workflow.
-
Add the connector between the Logger and Next Loop.
-
Add the connector between Next Loop and foreach loop.
-
Add the "Next Step" event to the connector of Next Loop and foreach loop.
-
Save the Next Loop activity.
