Datatable duplicate manipulation with Enumerables? - GROUP_CONCAT()

Hello Everyone, :vulcan_salute:

I’m trying to filter through a Datatable built from an Excel file in order to group duplicate values AND Concatenate the values of the duplicate rows at the same time to output it in a new Excel.

This is known to me as a SQL GROUP_CONCAT() but I got really stuck trying to do something similar in Studio.

This will maybe be more clear with a very simplified exemple:

My matrix looks roughly like this:

column1 | column2 | column3
abc | abc | 123
abc | abc | 456
123 | abc | 456
123 | abc | 789
456 | abc | 456

What I need to do is to Concatenate the Values of the Duplicates and group the by their “id”, it would then return somethig like this:

column1 | column2 | column3
abc | abc | 123, 456
123 | abc | 456, 789
456 | abc | 456

I’m not familiar with LINQ. I would be really greatful is someone has an idea of implementation with a DataTable.Select() method or Enumerables but I’m open to suggestions at this point… :see_no_evil:

Thanks :slight_smile:

Hey @Salvador_Benites

Kindly explore GroupBy linq query and develop the code.

If you face any challenge or issue please let us know


Hey @Salvador_Benites

Kindly go through this LINQ | LINQ Pivot | Create Pivot Table Using LINQ | LINQ Uipath | Uipath Tutorials | Coderslobby - YouTube


Hello @Salvador_Benites

Please refer to the below video. It will help you to find the similar & dissimilar rows in the datatable using linq.

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