Linq query group by rows and group the value

Hi all, I am newbie on UIPATH. Can anyone help me solve this problem by LINQ?

UIPATH

Gashu

@Gashu.REMUS
Welcome to the forum

give a try on following:

  • prepare an empty datatable - assign activity:
    left side: dtReport
    right side: YourOriginDatatableVar.Clone

  • use an assign activity:
    left side: dtreport
    right side:

(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 ra = new Object(){k,n,p}
Select dtReport.Rows.Add(ra)).CopyToDataTable
4 Likes

@ppr

Thank you for your help! However, I had got the error as below:
Assign: Object reference not set to an instance of an object.

UIPATH2

Gashu

is this done and ensured?

Also the output from the LINQ is returned to dtReport:

@ppr O!! It’s work!!! Thanks a lot!!!

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