How to check if a value is duplicate and if duplicate need to delete both line in Datatable

hi Team,

I have a Datatable with few Line of Data, my aim is to check whether there is any Duplicate value and if there a duplicate line, i that Duplicate Value & i need to remove both lines that created duplicate.

Input
image

my expected Output would be
image

Any Suggestion will be helpful
Thanks in Advance

Thanks & Regards
Harsha

Hi

Let’s take like you have a datatable named dt

If you want to remove the duplicate rows then use the below expression in a assign activity like this

Dt = Dt.DefaultView.ToTable(TRUE,”Columnname-1”,”columnName-2”,….”ColumnName-n”)

Here TRUE will give us the unique records in the datatable

Cheers @harshavardhan3457

hi @Palaniyappan ,

Thanks for the quick Response.

I have already tried the data view & its is giving only distinct fields in a selected column. But my use case is to find and remove the item completely which is creating the reason for duplicate.

have a look here when all cols are to check
https://forum.uipath.com/t/howto-find-duplicate-nonduplicate-rows-checking-all-columns-without-explicit-listing-the-colnames-index/222597/5

in case of duplicates are detected on 1 or only few cols then we can identify the duplicates with the help of a group by

Hi @harshavardhan3457

Please find the below attached xaml file.

Remove_Duplicate_Row.xaml (10.0 KB)

Try this and let me know whether it meet’s your expectation.

Feel free to reach us at any time if you have doubts.

Thanks.

1 Like

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