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

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!

1 Like

Hi @pal1910,

Refer this post

Regards,
Arivu

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!!

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

Hello again @arivu96

I still do not get it.

Could you send me one image please?

Thanks in advance!

Hi @pal1910,

Refer this xaml file
DuplicateInTheDatatble.xaml (14.7 KB)

Regards,
Arivu

2 Likes

Thank you very much @arivu96 !!!
Best regards

hi,

follow below tutorial on remove duplicates activity,

thanks,
Karthik.

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

You can use remove duplicate rows activity