Skip to main content

How to use 'For Each' Node?

· 2 min read
Cansel Kahraman

When dealing with an object containing an array property or a simple array and the need arises to iterate through each element for individual processing, you can use the 'For Each' node to run your operations.

How to Setup?

To begin, Login to your Robomotion workspace. If you haven't registered yet, you can create your workspace from the provided link.

Configuring 'For Each Node: Input Specifications

  • The name of the object property or array name must be entered in the 'Loop through object' field.

  • Access each item in the array using the 'Current Item' property.

Details of ‘JSON to Data Table’ Node Inputs

Flow Steps

  1. The 'Inject' node is used to initialize the flow.
  2. Use the 'Function' node to create the array.
msg.arr = ["https://forum.uipath.com/t/new-for-each/480760", "https://www.robomotion.io/", "https://explore.robomotion.io/"];
return msg;
  1. The 'Open Browser' node is used to open alternative browsers. Use the 'Open Browser' node before the 'For Each' node because you should not open a new browser for each array element.

  2. The 'For Each' node is used to go through each element in the array using 'Go To' and 'Label' nodes.

  3. The 'Open Link' node is used to open the defined link from 'Input-URL'. Map the 'Go To' node to the 'Label' node. When the 'Go To' node's turn comes, the flow continues with the 'Label' node.

  4. The 'Close Browser' node is used to shut down the browsers.

  5. Stop the flow by using the 'Stop' node.

Flow

Here you can access the complete flow by clicking on the following link:

https://casestudies.robomotion.io/designer/shared/Nqmh1UhFkC8yoVKoh5Ktxm