How to check if there are duplicates in the rows of Data Table


#1

Hello! I’d like to know if there is a easy way to check if there are duplicates in the rows of a data table with 1 column.

Thanks a bunch!


#2

Hi @pal1910,

Refer this post

Regards,
Arivu


#3

Thank you very much.
I see in the post the following instructions:

Duplicate records from the same data table
(From p in dt.Select() where( From q in dt.Select() where string.Join(",",q.ItemArray).Equals(string.Join(",",p.ItemArray)) Select q).ToArray.Count>1 Select p).ToArray.CopyToDataTable()

However, I have no idea about how to apply it…

Thanks!!


#4

Hi @pal1910,

use Assign activity

dt=(From p in dt.Select() where( From q in dt.Select() where string.Join(",",q.ItemArray).Equals(string.Join(",",p.ItemArray)) Select q).ToArray.Count>1 Select p).ToArray.CopyToDataTable()

If you have only one column use below
Distinct Based on the specific column name from the data table.

DataTable =DataTable.DefaultView.ToTable(true)

Regards,
Arivu


#5

Hello again @arivu96

I still do not get it.

Could you send me one image please?

Thanks in advance!


#6

Hi @pal1910,

Refer this xaml file
DuplicateInTheDatatble.xaml (14.7 KB)

Regards,
Arivu


#7

Thank you very much @arivu96 !!!
Best regards


#8

hi,

follow below tutorial on remove duplicates activity,

thanks,
Karthik.


#9

Hi ,
Please let me know if we can check if a particular row item is repeated???


#10

You can use remove duplicate rows activity