How to remove duplicates from datatable

Hi All,

I have two datatables

1st datatable:
Column 1 column2
10/6/2019 IOFF
10/26/2019 OFFT

2nd datatable
Column1 Column 2
10/6/2019 IOFF
10/26/2019/ OFFT
10/26/2019 Prot

I want output after removing duplicates

10/26/2019 Prot

Can anyone suggest me how to do these

Thanks

Srikanth

1 Like
1 Like

@Srikanth_prem

Use Join DataTable activity to do this.

https://docs.uipath.com/activities/docs/join-data-tables

@lakshman @asesor-rpa

Here I don’t want to join if I join somewhat dupliactes is there I don’t want to remove that one

The whatever data in first datatable I have to remove in second datatable

Can you please suggest me how to do these

@aksh1yadav @Palaniyappan @Dominic @Susana

Thanks
Srikanth

Fine
I hope this would help you
—let’s take like we have two datatable ready dt1 and dt2
—now use a BUILD DATATABLE activity and create same structure of columns as in these two datatable and get the output with a variable of type datatable named Finaldt
—now use a for each row loop and pass the dt1 as input and change the variable name from row to row1 and inside the loop use another for each row loop with dt2 as input and change the variable name from row to row2
—now inside the inner for each row loop mention a IF condition like this
Not row1(0).Equals(row2(0)) and Not row1(1).Equals(row2(1))

If true it will get into THEN PART where we can use a ADD DATAROW activity and mention the datatable as Finaldt and ArrayRow property as row1.ItemArray
This will add the mismatch data to the Finaldt datatable

Cheers @Srikanth_prem

1 Like

Hi @Srikanth_prem

Use Remove duplicate rows activity

Thanks
Ashwin.S

@Palaniyappan

But Iam getting the extra rows actually my dt1 is having 28 rows. And Dt2 is having 2 rows(which I need to check with dt1)

If iam using two for loops iam getting 42 rows

Can you please help me

Thanks
Srikanth

@Srikanth_prem,

I was recently using package created by @sandeep13 named Auxiliobits - Set Operation on DataTable . This package will solve your purpose like charm…

One sample for your reference i am attaching over here… This will work once you install that package.
Note : please read the instruction given in the article ( since its minus activity so greater need to be subtracted from lower)
Difference in Datatable.zip (8.7 KB)

Link for the package : Set Operation like minus ,intersect, union Operation n datatable

Ahtesham

3 Likes

@md.ahtesham thanks it worked!!!

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