While performing automation, we might be required to take the values from a particular column and then convert it to list so that we can perform further actions or decision flows.
Let us see how to do it in UiPath?
_myList = ( From row in dt_Sample.AsEnumerable() Select Convert.Tostring(row(“ColumnName”)) ).ToList()
1. ColumnName is the specific column name which you want to convert to list
2._myList is the variable containing your values
Implementation using UiPath :
Let us implement a workflow which takes a sample data table as input and converts particular Column values into a list of string.
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 “_myList” 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.
Click here to download the Source Code…
Hope it has helped you…