UIPATH Group by sum using LINQ

Hi Everyone,

I had tried to group and sum the datatable using LINQ. However, I got the error “Assign: Arithmetic operation resulted in an overflow.”

(From d in YourOriginDatatableVar.AsEnumerable
Group d by k=d(“GroupID”).toString.Trim into grp=Group
let n = String.Join(“,”,grp.Select(Function (x) x(“Value1”).toString.Trim).Distinct())
let p = String.Join(“,”,grp.Select(Function (x) x(“Value2”).toString.Trim).Distinct())
Let s=grp.Sum(Function (x) CInt(x(3).toString.Trim))
let ra = new Object(){k,n,p,s,d(“Value4”).toString}
Select dtReport.Rows.Add(ra)).CopyToDataTable

Can anyone help me?


Check this below link, @Gashu.REMUS

Hope this may help you :slight_smile:

@Manish540 Thank you for your help.

I knew why I have the error message now. It is because I need sum the value seem as 10000000000. It is out of the range. May I know is any ideas do solve this issues?


I had fixed the problem. I changed the Clnt to CDbl and fixed the problem. Thank you for your help!!!

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