Hello Team,
I have a dt (Col1 - int, Col2 - String…),
I want to convert Col1 to string, to perform further operation of taking all values of col1 to list,
Please guide,
Thank you
@msalesforce777
the list retrieval can be done directly with following:
YourDataTableVar.AsEnumerable.Select(Function ( r ) r(“Col1”).toString).toList
For DataTable Columns Conversions have a look here:
DT_ConvertToString_AllColumns.xaml (8.1 KB)
1 Like
Or using a LINQ expression like follows:
dt2 = (From row In dt1.AsEnumerable
Select dt2.Rows.Add(CStr(row.item(“Col1”)),row.item(“Col2”))).CopyToDataTable
NOTE: It assumes you already have created dt2 in appropriate structure.
Cheers
If you want to convert complete column to list of string or array of string then you can try below steps as well-
- Read excel sheet using Read Range
- Filter data table to get only col1 using Filter Data Table activity and store to some data table variable dt2
- Convert dt2 from data table to string using output data table activity
- Then split the output string with new line and store the result in string array
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.