Subscribe

UiPath Activities

The UiPath Activities Guide

UiPath.Core.Activities.ForEach

Performs an activity or a series of activities, specified in the Body section, on each element of a collection. The elements can be referenced in the activities in the Body section by using the iterator variable, item.

Properties

Common

  • DisplayName - The display name of the activity.

Misc

  • Private - If selected, the values of variables and arguments are no longer logged at Verbose level.
  • TypeArgument - A drop-down list that enables you to choose what variable type you want to use with the activity.

📘

Important!

When changing the argument type, the content of this activity is deleted.

  • Values - The variable whose values you want to iterate. This field supports only IEnumerable variables.

Output

  • Index - A zero-based index that specifies which element of the current collection is being iterated, stored in an Int32 variable.

Using the For Each Activity

For this example, we use a simple IEnumerable variable comprised of three elements, displaying each of them in a Message Box:

  1. Create a new Process and drag a For Each activity into the workflow designer.
  2. From the Variables panel, create a new IEnumerable variable, called List with the following value:
{"one", "two", "three"}
  1. Insert the List variable in the Values property of the For Each activity.
  2. Drag a Message Box activity into the Body section of the For Each activity.
  3. Insert the item iterator variable into the Text property field of the Message Box activity.
  4. Run the file. The For Each activity iterates through each of the values specified in the List variable and displays it in a separate message box.

Updated 28 days ago


For Each


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.