Hi Guys,
How can I extract only the specific column data from a datatable and create a new datatable with that column data.
Please help me figure out this.
Hi Guys,
How can I extract only the specific column data from a datatable and create a new datatable with that column data.
Please help me figure out this.
You can use select method or filter datatable activity.
Say you have datatable - dt1 of 1000 records and 30 columns
If you want some specific rows from all columns you can do something like
Dt2=Dt1.select(“column name=‘filter option’”).copytoDatatable
Dt2 is new datatable that you want
And if you want some coulms only then
Dt2 = dt1.defaultview(true,“coulm name”)
Dt2 is datatable in which you have single column with all rows
Hope you found my explanation simple
Regards,
Aditya
please find the attached workflow
GetSelectedColumnsFromDT.xaml (11.4 KB)
regards,
Pathrudu
Mr. Chitakayala
Great solution, It helped me really well, after I have wasted 3-4Hrs time.
hey @pathrudu @ImPratham45
how can i store the column data into a string by comma separation?
Use this LINQ :
String.Join(“,”, dtTable.AsEnumerable().Select(Function(row) row.Field(Of String)(“ColumnName”)).ToArray())