Understanding Compare Datasets - Multiple Matches - Include All Matches option

Describe the problem/error/question

Hello,

I am having difficulties understanding how the “Compare Datasets” node, specifically the “Multiple Matches - Include All Matches” option, works.

My objective is to check how many IP addresses are the same between two different datasets. If there are multiple identical IP addresses between the two systems, I filter those out later, as they require manual checking and are not supposed to be matched automatically.

The problem I am experiencing is that when I try to compare “one way,” I get 1 item. I count that as a match between IP addresses from the two systems and link device A to device B. However, when I reverse the comparison, I get 3 items, which I then filter out because I find more than a single match.

What I am trying to achieve is to match a single IP address from two different datasets. If there are multiple identical IP addresses on either side, it should not count as a match. Therefore, in the output, I should not get just 1 item but rather 3 items.

My question is: Why, when I compare one way, do I get 1 item even though I selected “Include All Matches,” but when I reverse it, I get 3 items? Shouldn’t it give me 3 items in both situations?

Thank you for your help.

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.49.0
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @apdeitas! Thanks a great question :thinking: Will ask about this internally.

Hello @apdeitas,

You are excluding “Name” from the comparison. The use of “Multiple matches > Include All” is more obvious if you don’t do that.

If it is off, only the first item matched; the rest would go to the “only in B” branch.

You are seeing different results because it is always branch A that is compared to branch B. By ignoring the “Name” field, you receive one item because only one is in input A. When the inputs are switched, you receive three items because three are in input B, and they have all found the matched item in input A.

I’m not entirely sure of your use case, but it looks like the “Summarize” node could be helpful here.

2 Likes

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