Sumup the value in column

image

this is my input,if my item description is repeated for same ponumber, i need to add up the quantity. where output should be like

image can any one help on this?

1 Like

Hi @priyankavivek

I have a easy way of doing it :slight_smile:

Use this component to aggregate the data in your data table :slight_smile:

Group by the item description and then Sum up the quantity column…
How to use the data table consolidate activity of this component is also provided in the manual attached to it…

Try it out :slight_smile:

thank you ,i will make a try now

1 Like

Flowchart.xaml (7.7 KB)
i have done it,but while checking it in writeline it shows empty

@priyankavivek Please find the attached zip file.Sample.zip (18.5 KB)

sorry i was unable to understand the flow which is in re framewrk

Hello @priyankavivek
You can use Linq Here
First we’ll Create a list of a double Variable and assign this Code
(From row In DT.Select Group row By id=row("C2") Into gg = Group Select gg.Sum(Function(r) cdbl(r("C3")))).ToList
it’ll group by the table get the sum of number in 3rd column

Second
group by your Datatable using this code
(From row In DT.Select Group row By id=row("C2") into gg = group select gg(0)).copytodatatable

Then create another Datatable Variable and create a default view of it with just two columns 1st and 2nd one using this code
DT.DefaultView.ToTable(False,"C1","C2")

Than use a Add Column Activity and Create a New Column

Than using For each row Assign this value to the newly created Column
dbl(dt1.Rows.IndexOf(row)).ToString

and in the end use a Write Range Activity to get the desired Output
check this workflow for better understanding
GroupBySum.xaml (12.2 KB)

1 Like

@priyankavivek Its not in reframework,I just modified your workflow.

1 Like

Hi @priyankavivek

Sorry for my late reply…

I just changed it a bit. You don’t need to have it inside a for each row loop… Pass in the DT and gets the consolidated DT…

let know whether this works.
Flowchart.xaml (6.1 KB)

1 Like

thanks for your reply ,i got the solution with that activity.

1 Like

thanks for your kind reply i got the solution.

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