Appreciate some help please. I’ve read multiple posts and spent 3 days trying to find a solution but am struggling. Think I must be missing something obvious.
I have a flow in which community events are extracted from emails and stored in Airtable. The same event could appear in multiple emails so I need to prevent creation of duplicates. An event is a duplicate if it has the same description and start date.
Describe the problem/error/question
I have tried using the compare and merge nodes to prevent duplicates but duplicates continue to be created.
Prior to compare/merge node the date is set to a consistent format.
I am running n8n cloud version 1.65.2
Please share your workflow
Here is the workflow with the compare node - I can add the workflow with merge node if needed.
I went to copy the output data and discovered that the airtable Edit Fields node was introducing a space at the end of the date. After an hour I could not find the source of the error so I deleted the node and created a new one with the exact same code and (weirdly) it worked. There are now no duplicates in the “In B only” output, huzzah!
However, a question: I need the list of records that are the same in both inputs (as I want to update the airtable record with the email subject from both emails). I thought I could get this from the “Same Branch” output but these are displayed in the “Different Branch”. Why is that?
Also just want to check: I viewed the output data from the Edit Fields nodes by clicking on the the pen icon /edit output option at top right on the output of each node. Is that how I should do it or is there another way?
Yep, they should be in the Same branch. I could say more if you will provide some samples
Pen icon is for pinning the data, if you pin it, then on the next run the n8n will use pinned data instead of requesting the actual data from the service.
Ah ok thanks @barn4k - so how do I request actual data from the service? I was clicking on the pen icon, highlighted below which gave me the JSON which helped me spot the problem. (I was not clicking on the pin icon next to it).
Many thanks for your help @barn4k .
The items in “In A only Branch” and “In B only Branch” are correct however there is nothing the Same Branch. The same records appear in the Different Branch for some reason? Screenshots from the compare node below with same records highlighted.
oops just realised there is sensitive info in the workflow I pasted at th etop of this topic. I’d like to remove all nodes except the compare and two edit fields(set) nodes before it. I can no longer edit that. Is there a way to update it please @barn4k ? Sorry I’m just new
Actually there is a JSON button to the left of it. The button you have highlighted is for editing the output data and if you press save after edit, it will be pinned (the node will have s blue icon)
As for the compare node, still I need output from the two edit field nodes to test it. You may remove any sensitive info from it and paste the json output of each nodes.
I’ve attached a workflow for an example of how the Compare node works
Maybe, your payload in Airtable and in Email have some other fields, which present only there
Thank you for this example @barn4k . I can now see that for the records to appear in the “Same Branch” The names of the input fields that are being matched must be identical. I did this and the Same Branch is now outputting the correct records.
However, I need the Same Branch records to contain the newsletter subjects from both inputs (so that I can note all newsletters that the event appeared in). In the Same Branch records I can see the newsletter subject from Input A (Airtable) but the newsletter subject from Input B (email) does not appear per the following screenshot. I have played with the parameters in the Compare node but cant get it to work. What should I try please?
Thanks for your time on this @barn4k I’ll set the the example workflow you posted as the solution as that was the breakthrough. Also appreciate your advice on viewing JSON rather than table to pick up spaces etc. Thank you.
Regarding the last problem I was trying to describe - I found a workaround. Afraid the Different Branch would not have worked but thank you anyway . I wanted records that match on description and start date only but I also want to input other fields so that they appear in the output for use downstream of the Compare node.
If it helps - the items do not need to be identical for records to be in the Same Branch as it is possible to:
a) specify which fields to match on, and
b) specify which fields to skip
(Per latest screenshot)