indiedev91
(Indie Dev 91)
1
i want to remove every columns after a specific index in assign activity and assign to datatable directly
This is what i have tried
dt = dataTable.Columns.Cast<DataColumn>().Take(17000).CopyToDataTable();
but .CopyToDataTable(); is not working as how it does with rows , where for row i used the below line
dt = dataTable.AsEnumerable().Take(1050000).CopyToDataTable();
lrtetala
(Lakshman Reddy)
2
Hi @indiedev91
Try this
dt = dataTable.DefaultView.ToTable(False, dataTable.Columns.Cast(Of DataColumn).Take(17000).Select(Function(c) c.ColumnName).ToArray())
2 Likes
Parvathy
(PS Parvathy)
3
Hi @indiedev91
In case of C#:
dt = dataTable.Columns.Cast<DataColumn>().Take(17000)
.Select(col => new DataColumn(col.ColumnName, col.DataType))
.CopyToDataTable();
In case of vb:
Assign dt = (From col In dataTable.Columns.Cast(Of DataColumn)().Take(17000)
Select New DataColumn(col.ColumnName, col.DataType)).CopyToDataTable()
Hope it helps!!
Regards
indiedev91
(Indie Dev 91)
4
im trying c# one but .CopyToDataTable(); is still hoghlited in red
dt = dataTable.Columns.Cast<DataColumn>()
.Take(17000)
.Select(col => new DataColumn(col.ColumnName, col.DataType))
.CopyToDataTable();
ppr
(Peter Preuss)
5
Can you confirm
is it about the number of columns or rows?
For Datarows we would do:
VB.Net
dt =
dataTableVar.AsEnumerable.Take(17000).CopyToDataTable
indiedev91
(Indie Dev 91)
6
i was having the same scenario for rows but its completed wih the help of dt = dataTable.AsEnumerable().Take(1050000).CopyToDataTable();
but i cant do the same for coulmns
ppr
(Peter Preuss)
7
we are in doubt that your datatable has 17000 columns
Please use the immediate panel and share with us the output
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum
dataTableVar.Rows.Count
dataTableVar.Columns.Count
dataTableVar.Columns
indiedev91
(Indie Dev 91)
8
It doesnt have , but it can , im making an activity which takes datatable as input and i want to limit the amount of data it can take
ppr
(Peter Preuss)
9
then we recommend redefining the details:
given input:
- datatable with X columns and Data / No Data
Expected output:
- datatable with subset of Columns and Data / No Data
Kindly note:
was already mentioned to you
system
(system)
Closed
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.