While performing automation, we might be required to take the values from a particular column and then convert it to a list , so that we can perform further actions or decision flows.
lets see how we can implement this in UiPath.
my_list = ( From row in dt_Sample.AsEnumerable() Select Convert.Tostring(row(“ColumnName”)) ).ToList()
- ColumnName is the specific column name which you want to convert to list
2._myList is the variable containing your values
Implementation in UiPath**
Let us implement a workflow which takes a sample data table as input and converts particular Column values into a list of string.
***Step 1:***Drag “Build Data Table” activity into the design panel and populate it with some sample data.
Drag “Assign” activity into the design panel and fill it with above-mentioned code.
Drag “For Each” activity into the design panel and pass the above “my_list ” variable to it.
Drag “Message Box” activity into the For Each activity and pass the “item” value into it.
Finally, let’s run the project.
Now, we can see all the values in the columns being displayed.
I hope you enjoyed the article.