Hi Team,
I am new to UiPath and have encountered on a problem statement that would need your help.
Basically i need to convert the DataTable in ‘AS-IS’ to ‘TO-BE’. Output in DataTable. Column ‘Date of Sale’ and ‘Type’ to be unique and sum the value in column ‘Price ($)’. Pls see screenshot below
Appreciate your help.
@pzgqq414
welcome to the forum
we can do it with the help of group by:
-
assign activity
left side: dtResult | DataType: DataTable
right side: YourDataTableVar.Clone -
assign activity
left side: dtResult | DataType: DataTable
Right side:
(From d in YourDataTableVar.AsEnumerable
Group d by k1=d(0).toString.Trim, k2=d(1).toString.Trim into grp=Group
let sm = grp.Sum(Function (x) CInt(x(2)toString.Trim))
let ra = new Object(){k1, k2, sm}
Select r= dtResult.Rows.Add(ra)).CopyToDataTable
Hi,
Thanks for the help provided. Appreciate it