Incorrect records being compared

Describe the issue/error/question

Unsure how to explain this. I have a list of 10 items. Of the 10, 3 already appear in the target database. On those 3 records, I want to check if the 1st name in the source data matches with the 1st name in the target data base. If it does then I will update the item in the target data base. If not send me an email for manual intervention.

Jasper, Mike and Phillip do appear in the target data base and the 1st names do match, but the IF statement says false. My struggle is the IF statement doing the comparing seems to not be comparing the same items. I am not sure what it is doing.

It seems to be comparing the target database Jasper item with the source Luke item, and not looking for Jasper in the source Jasper item. I have no idea how n8n ensures its always checking the right records, but up until now its has just magically done it. Stumped!

It’s a complex flow with a fair degree of data manipulation of the source data. I am passing the full data set through each SET node so I can use that data is subsequent nodes. Below is the section of the flow where I am having the issue.

Please share the workflow

The issue is probably a mismatch in the number of items the merge node return and what the Mautic node return, which causes that cause the IF node not to compare the data correctly. I cannot confirm it because I need to see the returned data. Can you please record a loom video and share it? Please send it over to me privately if you cannot share it here.


Simply put, In the current sample data set we are using there are 10 paddle records.
3 - exist in Mautic, share the same email, and have the same 1st name - need to update in mautic
0 - exist in Mautic, share the same email, but DON’T have the same 1st name - I need to be notified via email
7 - Don’t exist in mautic and need to be created in mautic.

Workflow solution:

Hi @RicardoE105

Today I took the automation live with real data (demo entries via the live system) and I have picked up a few issues. They seem to relate to the functions that you wrote for me, so I am not equipped to resolve.

The flow is perfect for single person entries.

For 2 person entries, there is an issue with paddler 1 being created as a new record in mautic with all the correct details, except paddler 1 is given the first and last name of paddler 2. On checking the nodes the info is all mapped correctly and returning the correct data so I have no idea why this is happening.

I don’t have a sample data to test the 3 man entries but I suspect there will be a similar issue.

I am supposed to go live with the entry system on Monday so I am under pressure to resolve this.

I do note in the function nodes you wrote there seem to be missing json output fields.
I assume there should be first and last names fields for padder 1, 2 and 3 as well as proper case names for each each aswell? That does not alway seem to the case.

Unsure if it that is related to my issue?

PS, there are a few other minor issues like the email nodes sending me empty emails, ie something is triggering the true branch of the IF node but it should not be.

Also it seems a merge node with append, does not pass on any data at all if one of the inputs is empty. I have posted a topic in the forum on that.

My main issue is the incorrect data mapping, I can live with the other issues for a short while longer.

I seem to have fixed through 1000 try and error attempts. Mapping correctly now.

Ah great that you figured it out.