How to delete data row of one data table based on other matching data row of other datatable?

I mean to delete rows from data table that exist in another data table. Match & delete
there is no such primary key for any of the record in both data table.

Hey @sauvaish

If i’m right, you are comparing two datatables and need to delete the identical rows from one datatable, for this you can use Remove Data Row activity by passing the datarow object in the property.

Thanks,
Goutham Vijay

Hi Goutham,

Thanks for Replying!!
Actually i want to delete row from Test.csv that exactly matches Test1.csv row.

Test.zip (319 Bytes)
Test1.zip (248 Bytes)

Thanks
Saumya
.

1 Like

Hi @sauvaish

Your files(csv) doesn’t have column headers. While comparing both, first we should see the count of column headers.

Thanks,

Hi Goutham,

Can u please elaborate.

Buddy @sauvaish

Welcome to UiPath Community buddy and thats really a good question to start with

Its resolved buddy
Here you go, run the xaml buddy
Test.zip (11.8 KB)

Kindly try this and let know buddy
Cheers

hi @sauvaish

you can achieve this using linq
Find the attachment below,
Unmatched.zip (11.4 KB)

dataTable 1
d1

dataTable 2
d2

here you can see highlighted records are matching,
and here’s the output with unmatched records
res

hope this will help you.

Thanks @Palaniyappan

Done!!

1 Like

Thanks @samir.

Thats great…
Kindly make a comment marked solution buddy @sauvaish
Cheers
Keep going

This query works for A column only…
how do I match the whole row?

Hi!

Is there a way to make this skip error if datatable A has no data in it? I have repetive function which has the datatable A empty every now and then. This causes it to have error.

image

Hi @Lari_Pyykonen

Welcome to our UiPath Forum! :slight_smile:

I’d suggest adding a simple IF condition and only process the data if there is something in there. It could be something like:

dtVar.Rows.Count > 0

This will return true if there are rows and false for no a dtVar with no rows.