Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Work Tasks

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.

  1. Drag the ForEach-Loop activity from the Engine Activities section to the workflow.

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

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

  4. Add the logger to log the information of the iterated node values.

  5. Add the step event to the connector.

  6. Change the properties of the logger. Add Logtype as 'Information'. Click on the LogMessage icon to get the editor below.

  7. Select XML variables, iterator and variable. Click on the Update button.

  8. Save the Logger workflow.

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

  10. Add the connector between the Logger and Next Loop.

  11. Add the connector between Next Loop and foreach loop.

  12. Add the "Next Step" event to the connector of Next Loop and foreach loop.

  13. Save the Next Loop activity.

TitleResults for “How to create a CRG?”Also Available in