From 2 data tables get the ones not matched

Hi all :slight_smile:

I am doing an automation in which I do need the values not matched between 2 Data Tables. In filter i use =! but it is not working…

How could I do it? :slight_smile:
Many thanks in advance!

Angel

Hi @Angel_Llull
check this link for linq query for getting common or uncommon rows between datatables

1 Like

As an alternative I believe the problem you are asking is very similar to this one and requires a bit less working knowledge of the .net framework than the above response.

Ultimately it is good to get comfortable with core data structures as they can add a lot of flexibility/capability to your automations.

1 Like

Many thanks! I will check them!! :slight_smile:

The simplest way to do this without a lot of programming would be to loop through the DT1 and compare each row to DT2. Keep a count of if there are any matches for the row from DT1 and if the count is still 0 at the end, assign that row to DT3.

Then do the same by looping through DT2 and comparing to DT1.

counter=0
For each DT1row in DT1

  • For each DT2row in DT2
    – If DT1row.Item(0) = DT2row.Item(0) AND DT1row.Item(1) = DT2row.Item(1) …etc…
    ---- counter = counter + 1
  • //For each
    If counter = 0 Then add DT1row to DT3

//For each

Something like that.