Compare multiple columns in a joined table

Hi. I would like to be able to loop through each column within two joined tables and compare the values in each row. For example, I have used the Joiner node to join the following two tables using Employee ID as the match.

Table1
|Employee ID|First Name|Last Name|Person Type|
|0001|Bugs|Bunny|Employee|
|0002|Mickey|Mouse|Employee|
|0003|Charlie|Brown|Ex-Employee|
|0004|Pink|Panther|Employee|

Table2
|Employee ID|First Name|Last Name|Person Type|
|0001|Bugs|Bunny|Employee|
|0002|Mickey|Mouse|Ex-Employee|
|0003|Homer|Simpson|Ex-Employee|
|0004|Pink|Panther|Employee|

Is it possible to loop through each column of the two tables to compare the values in all of the rows. I have done this using the column comparator node for each of the columns but some of the data tables that I will be comparing will have more columns to compare.

The expected output would be an Excel file for each column showing the mis-matches.

Thanks in advance
Chris

Hello @fostc80857 ,

have you tried with a table difference finder node?

Have a nice day,

Raffaello

1 Like

Hi @lelloba

I have tried this, but it does not give me the results I am after. In my actual data sets, there are some records that are in table 1 that are not in table 2 (and vice versa). This is why I have used the Joiner node so that it gives me the three results (join, left unmatched, right unmatched).

I then have to compare each of the columns in the join (matched) table to see where there are data mismatches (e.g., same employee ID but with different names).

Could I use a column splitter to separate out the joined tables and then the table difference finder node?

If you need to find mismatches, I’d do it in this way.

First, use the joiner node exactly as you suggest. Include matching rows, left and right unmatched rows, so you can see everything.


Secondly, use a column expressions node and create one column per rule:

  • if column first name on left table == column first name second table, then “Ok”, else “Different”
  • if column last name on left table == column last name second table, then “Ok”, else “Different”
  • same for all other columns

immagine

Then, you can filter rows accoridng to the problem you want to target using a row filter node (example: select all rows having a mismatch on “person type”) and eventually even export it.

Is this helpful?

Raffaello

2 Likes

Thanks @lelloba , I will give this a try.

What is the correct syntax for enering the if function as you have suggested in the column expression node? Apologies, I am new to this.

No worries, everyone is here to learn :slight_smile:

How would I enter the expression for each column when I configure the node? Could you give me an example of the syntax to use within the configure dialog box?

I have attached my workflow above. If you open the column expressions node, you’ll find the syntax.

That’s worked. Thanks for your help!

1 Like

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