Hello folks,
I have a data table that looks like this…
Column 1 | Column 2 | Column 3
1 | 1 | 1
2 | 2 | 2
3 | 3 | 2
4 | 4 | 3
5 | 5 | 4
And what I want to do is basically “split” that table into two table based on duplicates in Column three show in the end I should get these guys…
Column 1 | Column 2 | Column 3
2 | 2 | 2
3 | 3 | 2
Column 1 | Column 2 | Column 3
1 | 1 | 1
4 | 4 | 3
5 | 5 | 4
I could toss this into excel and handle it easy but I am trying to see if I can’t do it through just UiPath data tables. Any advice is appreciated.
2 Likes
asesor-rpa
(Nestor Andres Martinez)
2
Do you need put “Duplicated rows” apart in other DataTable?
asesor-rpa
(Nestor Andres Martinez)
4
I’m Think in a SQL Style that could be possible to reproduce in UiPath
let’s say we have this table:
Column1|Column2|Column3
1 | 1 | 1
2 | 2 | 2
3 | 3 | 2
4 | 4 | 3
5 | 5 | 4
-
Get Duplicates in Column3: Count values in Column3
select column3, COUNT(colum3) from mytable group by column3 having COUNT(column3) >1

-
Take Column3 values from previous step
select column3 from mytable having count(column3) > 1
-
Filter Original Datatable with previous values and put results in a new datatable.
DataView RowFilter Syntax [C#]
C# DataTable Select Example - Dot Net Perls
1 Like
Hey @FireflySeason2
you can do using Datatables
Datatable DuplicateResults = YourDatatableName.AsEnumerable.GroupBy(function(x) x("YourColumnName i.e Column3")).Where(function(x) x.Count() > 1).SelectMany(function(g) g).ToArray().CopyToDatatable;
Datatable UniqueRecords = YourDatatableName.AsEnumerable().GroupBy(Function(x) x("YourColumnName i.e Column3")).Where(Function(x) x.Count = 1).SelectMany(Function(x) x).ToArray.CopyToDataTable;
See my attached Sample for your better understanding and reference 
ColumnDuplicateSample.xaml (8.6 KB)
Regards…!!
Aksh
7 Likes
AshwinS2
(Ashwin S)
6
Hi @FireflySeason2
Use this post Duplicate rows in data table
Thanks
Ashwin.S
That worked great. Thanks a lot.
system
(system)
Closed
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.