Hello
I want to make this datatable
fruit price
apple 30
apple 50
apple 20
pear 20
pear 10
banana 20
banana 25
to
fruit price
apple 100
pear 30
banana 45
Please help me
@hoseongwon
Use the groupby function to get your desired output:
(From d In dt.AsEnumerable Group d By k=d(“fruit”).toString.Trim Into grp=Group Let value = grp.Sum(Function (x) CDbl(x(“price”).toString)) Let ra = New Object(){k, value} Select dtNew.Rows.Add(ra)).CopyToDataTable
regards,
1 Like
Wow. Thank you. but I am so new at UiPath. so hard to understand from begining. …(From “d” …what is d?
@hoseongwon , you can refer the below thread for a brief explanation:
This HowTo introduces on the different options for grouping data from a datatable in order to process the grouped data.
Introduction
Grouping data and processing the grouped data is a common scenario e.g. when the grouped data is to aggregate like summing up, find maximum, get the average or concatening items.
Lets have a look on following data:
[grafik]
A possible scenario could be:
Create a report containing following information:
the region code
the sum of CaseCount per RegionCode
t…
system
(system)
Closed
April 4, 2023, 12:05pm
5
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.