Group by multiple columns in data table and get count of one column and select rest of the non grouped columns

Hi , I need to group by three columns(name,class,leave) and count the values in “leave” column and add the values in last column as well as i need to get other non grouped columns.

@lk_18
welcome to the forum

have a look here as well:
https://forum.uipath.com/t/howto-overview-on-different-options-for-grouping-data-and-processing-the-groups/290708/4

Clone datatable: dtResult = dtDataTableVar
Add a new column to dtResult - Add DataColumn Activity - ColumnName: count

Assign Activity
Left Side: dtResult
Right side:

(From d in dtDataTableVar.AsEnumerable
group d by k1=d("Name").toString.Trim(),k2=d("Class").toString.Trim(),k3=d("Leave").toString.Trim() into grp=Group
let f = grp.First()
let ra = new Object(){f(0),k1,k2,f(3),k3,grp.Count}
Select dtResult.Rows.add(ra)).CopyToDataTable

Thank you. its working as per my need

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.