How to group by multiple columns from a datatable

Can any one help me on this below scenario?

Col1 and COL2 groups merge col3 summationQQ截图20201223211853

1 Like

You can use Compare data table if you compare the data-table means you can do
please check below

If you get the solution mark solution and close the topic

Thanks :beers: :clinking_glasses:
Chethan P

1 Like

Not compare the datatable.Need to group by columns Col1 & Col1 2 and fetch all Col3 sum as datatable.
Thanks and Regards!

Have a Look Here for an example with 1 Key

In your Case a linq could Look Like following
(From d in dt.asenumerable
Group d by k1=d(0). toString.trim.substring(0,10), k2=d(1).toString.trim Into grp=group
Let s= grp.sum(function (x) CDbl(x(2).toString)
Let ra = New Object(){k1,k2,s}
Select dtResult.rows.add(ra)).copytodatatable

dtResult is Just an empty datatable with the needed Output structure. Often IT can be Cloned from Origin datatable with dt.clone Statement.

Expect some minor issues with the Statement as i have answered from Cellphone and Cell Phone is often doin pairprogramming with me but Hits wrong parts into the code

EDITED: Link to our tutorial series

[HowTo] LINQ (VB.Net) Learning Catalogue - Help / Something Else - UiPath Community Forum


It’s what I need! Thanks~

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