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.
Table of Contents
Properties | Description |
---|---|
Activity Name | For Each Row in Data Table |
Description | It reads row-wise values from the given datatable. Work as an iteration. |
Package Used | UiPath.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.
- Open your UiPath Studio and create a new process. If you are working on an existing process you can also use that.
- 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 Table” activity and save this datatable in a datatable variable. Here were are using the “datatable1” variable to store the values.
![How to Use UiPath For Each Row in DataTable|Assign|Get Value UiPath Build Data Table Activity](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHW7ZoC9AAB7JdqdpXTNLfILw1NQRMwYV2U7G-KLpXni75dVvx511Vrn_9sO-lb28b9DMIA9arqbVASGlASnHgMKUkzam7ec4OPou-dl8V4JibpXnJFvVOe377YNwSOLz66N11ypssBY7bMUDnuxfrjOMu9EXRGLsTp3hs5IyNDg7dPOFXA0VTI5qTMQ/s16000-rw/Build%20Data%20Table%20in%20UiPath%20Studio.webp)
- 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.
- 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)
![How to Use UiPath For Each Row in DataTable|Assign|Get Value UiPath Output Data Table](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKv7WtGiB7IH0T1FZJlUSJ6FlWLuvKfZhvueQN8ctS3Q_JQ_kE_oAo2mfiep19o8PqUWsujdaw47Ly3FTYzKxwr6DUlsL59Hha8lkEfj83VNKuDJqJG_1HApgVfQurA6ro2mnGqWe1s9iMIFM6OOma9cn_Qvso5rPaRgjNpJxFXJ5-5_F2JB-qmfhnMQ/s16000-rw/UiPath%20Output%20Data%20Table%20Activity.webp)
- 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|Assign|Get Value How to Use UiPath For Each Row in DataTable](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcvvK8cniiuFaBOXBm0VXdimy7yGrooHWBomOLbrL9S6e_iCgDeWdfkIL3Kpg2NLND_ekHvplkuW4CdVz6C1Rg6DV-BeUBEP-T-u9wOKq_m_lxXqsM7pd0a5thfqqI4CzUY_ed31WXXh9PDFZxy7xk6PWI9HTkcqSVbSdtX8h-MnYZRTnaLmRSoZD2_w/s16000-rw/How%20to%20Use%20UiPath%20For%20Each%20Row%20in%20DataTable.webp)
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
Properties | Description |
---|---|
Input | ➊ DataTable: The name of the datatable variable. |
Common | ➊ DisplayName: The name of the activity which you want to display |
Output | ➊ Index: Stores index values |
Frequently Asked Questions
-
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