Group matching rows together

Hi Great Dev, I want to group Texas together on this column, since they match, please how do I do that?image

in case of you want to remove the duplicates e.g use Remove Duplicates Rows Activity for the datatable

or was the question about summing up group values?

If the value is the same, I’ll need to merge the matching values together like image

we cannot identify a merge, could it be the case that you would like it to get sorted together (refering to your screenshot)?

Or just provide us the expected output datatable, so we can use it for working out a solution suggestion

Yea, sorted together in the column as shown with screenshot

give a try on Sort Data Table Activity

Or

Assign Activity
LeftSide: dtSorted
Right Side:

(From d in yourDataTableVar.AsEnumerable
Let ic = CInt("0" & d("Code").toString.Trim)
Let spv = d("SpotVenue").toString.Trim
Order by spv, ic
Select r=d).CopyToDataTable
1 Like

Sort data table activity didn’t give me what I want, so I am using the assign but it’s throwing end of statement expected

Please always show error details to us. Thanks

[

please show us the Hovertext from the Blue Validation Icon:
grafik

As statement was checked locally and passed the validation we would like to see it driven from your implementation


This is it ppr

correct the line part (first Line) your dMatch

your datatable Variable has the name dMatch. the token your is unneeded and looks like a copy&paste issue / missining adoption task

Alright, I have corrected it

It worked, how about adding an empty row for each of the sorted group to separate them or make it distinct from the other rows.Any idea please

@RPA-botDev
Ideally we would avoid to modify the tabular data just for purpose to get a visual oriented (Group split by empty row) result.

From technical viewpoint we can do:

Assign Activity
LeftSide: dtRearranged | DataType: DataTable
Right Side:

(From d In yourDataTableVar.AsEnumerable
Group d By k1=d("SpotVenue").toString.Trim, k2=d("Code").toString.Trim Into grp=Group
Let nr = yourDataTableVar.NewRow
Let grpe = grp.Append(nr)
Select x = grpe).SelectMany(Function (x) x).CopyToDataTable

find starter help here:
GroupBy_2Col_GRPSeperator_InsertEmptyRow.xaml (7.3 KB)

1 Like

Thanks ppr

May we ask you to do your final testing and close the topic by marking the solving post as solution or just let us know your further open questions. Other can benefit from it. Thanks

1 Like

Alright ppr, I have marked as solution, if there is further, I’ll open another discussion and let you know.Thanks

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