Below mentioned the input and output I needed…(query is preferable)
Input
Datable
Name value
Lisa 1122
Muno. 1233
Hura. 1156
Lisa. 456
O/P
Lisa 1567
Muno 1233
Hura. 1156
Below mentioned the input and output I needed…(query is preferable)
Input
Datable
Name value
Lisa 1122
Muno. 1233
Hura. 1156
Lisa. 456
O/P
Lisa 1567
Muno 1233
Hura. 1156
Hey @Demo_User ,
You can do the pivot table using LINQ to get the expected output. Have a look at this LINQ | LINQ Pivot Table Aggregation | Sum LINQ Pivot | LINQ Uipath | Uipath Tutorials | Coderslobby - YouTube
Thanks,
Sanjit
Hi @Demo_User
Welcome to our community
Give a try with
(From row In dtInput.AsEnumerable
Group row By sc = row(“Name”).ToString()
Into grp = Group
Let total= grp.sum(Function (x) Convert.ToDouble(x(“Value”).ToString()))
Let result = New Object() {grp(0)(“Name”),total}
Select dtToWrite.rows.add(result)).CopyToDataTable
Regards
Welcome to the community
Please try this in assign activity with the below given formula on right and on left dtoutput…
dtoutput = (From d In dtinput.AsEnumerable() Group d By k=d("Name").toString.Trim Into grp = Group Let sum = grp.sum(function(x) cdbl(x("Value"))) Let ra = New Object(){k,sum} Select r = Dtoutput.Rows.Add(ra)).CopyToDataTable()
Before this use another assign with
Dtoutput = dtinput.Clone()
And if not working please confirm if your project is in c# or vb.net
Cheers
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.