In this tutorial, you will learn how to use UiPath For Each Row in Datatable activity. This Activity can be used on various use cases where it allows you to read row-wise values in a datatable.

With the help of this activity, now you can easily read the datatable values without knowing the row and column index.

PropertiesDescription
Activity NameFor Each Row in Data Table
DescriptionIt reads row-wise values from the given datatable. Work as an iteration.
Package UsedUiPath.Core.Activities.ForEachRow

What is UiPath For Each Row in Datatable Activity?

UiPath For Each Row in Datatable activity is similar to loop activity which allows you to iterate through each row in datatable so that every row value can be read. This activity is very useful when reading each row’s values in a datatable.

For Each Row in the Datatable activity take input as a datatable variable and iterate through each row of the given datatable. After reading the first row, it increments reads the new row, and continues.

You can also read each column’s values using “row.item(“ColumnName”).

How to Use UiPath For Each Row in Datatable Activity

As you are now familiarized with this activity. let’s check how you can implement this activity on your uipath studio. Here we will provide an in-depth explanation on how to use this activity with help of an complete example.

  1. Open your UiPath Studio and create a new process. If you are working on an existing process you can also use that.
  2. To Use For Each Row Activity in UiPath, you will require an input datatable. So first we will create a datatable using the Build Data Tableactivity and save this datatable in a datatable variable. Here were are using the “datatable1” variable to store the values.
UiPath Build Data Table Activity
  1. Now search for the “For Each Row in Datatable” Activity and add it to your workflow. Now enter the datatable name. Here we are using the “datatable1” variable. If you have a different datatable then you can use it.
  2. Now we will add an “Output Data Table” activity to convert the datatable to string. Now enter the input datatable variable (Here Datatable1) and output datatable. Output data table variable should be a string (only then we can show in message box)
UiPath Output Data Table
  1. Now add a message box to view the result in the message box. And add the string variable of the datatable. Here we are using the DataTable_Output variable to display the datatable values in the message box.
How to Use UiPath For Each Row in DataTable

You can use this activity to get values from datatable. The values will be read row-wise and after reading values from each row it will increment and reads the next row. So this activity works like a iteration in programming.

Properties of For Each Row in Datatable Activity

PropertiesDescription
InputDataTable: The name of the datatable variable.
CommonDisplayName: The name of the activity which you want to display
OutputIndex: Stores index values

Frequently Asked Questions

  1. What is UiPath For Each Row in Datatable Activity

    UiPath For Each Row in Datatable Activity is used to read row-wise data from a datatable. From the input datatable, it reads values one by one, like an iteration, and can be used this data for various purposes.

Conclusion

So far you have learned how to use this activity and implement it on your UiPath Studio. This activity can be used in various use cases where there is a requirement for reading datatable values.

Also refer, UiPath Docs