Error is displayed while using Group by Please some can answere this issue
I’m not able to use group by function in Ui Path using Linq
Can you share the code you are using
Assign activity: groupedData = yourDataTable.AsEnumerable().GroupBy(Function(row) row(“ColumnName”)).CopyToDataTable()
Share your linQ query and requirement. Then it will be better for understanding to check the error.
Hope it helps!!
dt2.AsEnumerable().GroupBy(Function(row) row(“Sale Price”).ToString)
At last you have to give what type you want to change if you want to change it to List use below
dt2.AsEnumerable().GroupBy(Function(row) row.Field(Of String)("Sale Price").ToString()).ToList() ' You might need to convert the result to a list or another data structure if required.
To convert to datatable :
dt2.AsEnumerable().GroupBy(Function(row) row.Field(Of String)("Sale Price").ToString()).CopytoDatatable()
Hope it helps!!
Hey @Taruna_Gupta,
If you want to convert it back to datatable you can use the below Linq,
dt2.AsEnumerable().GroupBy(Function(row) row("Sale Price").ToString).Select(Function(Group) Group.First).CopyToDataTable
If you want the result as a list or array to iterate through everything, you can use
dt2.AsEnumerable().GroupBy(Function(row) row("Sale Price").ToString).ToList
Sorry for the issue, can you try
dt2.AsEnumerable().GroupBy(Function(row) row("Sale Price").ToString).Select(Function(Group) Group.First).CopyToDataTable
(From row In dt2
Group row By a=row(“Sale Price”).ToString Into grp=Group
Select grp.first
).copyTodataTable