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()
Note:
1. ColumnName is the specific column name which you want to convert to list
2._myList is the variable containing your values
Example
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.
Step 1:
Drag “Build Data Table” activity into the design panel and populate it with some sample data.
Step 2:
Drag “Assign” activity into the design panel and fill it with above-mentioned code.
Step 3:
Drag “For Each” activity into the design panel and pass the above “_myList” variable to it.
Step 4:
Drag “Message Box” activity into the For Each activity and pass the “item” value into it.
Step 5:
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…