Datatable Activity Help

Hi All, can some one help me in extracting a specific column from a datatable and save it to a list

eg; sl.no Name city
1 Raju Hyd
2 Ravi Chennai
3 Ramu Pune

output to be name=[Raju,Ravi,Ramu]

Hi @ppadarthi

Use the below LINQ:

nameList = (From row In dt.AsEnumerable() Select row.Field(Of String)("Name")).ToList()

nameList is of DataType System.Collections.Generic.List(System.String)

You can use below expression to print in Message box:

String.Join(", ", nameList)

Hope it helps!!

4 Likes

Hi @Parvathy it helps, Thanks

@ppadarthi

Glad to have helped

Happy Automation!!

Solution shared by @Parvathy will work as expected

Just to add one point to avoid confusion

Make sure that the output variable for storing array value is of type List

1 Like

Hie @ppadarthi use the below image refrence

cheers

1 Like