Wait the end of the 2 nodes to merge

Hello

Describe the issue/error/question

I try to send datas to Airtable after a merge.
My datas are from Phantom(Buster)
There is 2 phantom that I merge with merge node to send to Airtable.
The problem : 1 phantom is faster so it send all the datas from the first Phantom before waiting the second one, then, when the second one has finished, it duplicates the line with the merge.
A wait isn’t possible because the time depend of the input gave to PhantomBuster.
If I do it manually : step by step and I wait for the merge to get the 2 input to send to AirTable it works perfectly.

Please share the workflow

Information on your n8n setup

  • n8n version: 0.174.0
  • Database you’re using (default: SQLite): ?
  • Running n8n with the execution process [own(default), main]: ?
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Desktop app

Thanks a lot,

Romain

I am assuming that you want to merge like objects. Maybe ones that have the same email address.
Maybe you could use merge by key.

Or if that does not work, Use a code block and in that code block following the upper node with more results, as a result comes through that node the code block will use a for loop to compare it to the values outputted by the lower node. If it finds a key match then the code block can merge those two items together and pass them on.

This is PseudoCode

arrayOfItems = $items("nameOfNode") to set a variable with access to all the output items 
comparisonNode = items[0].json
then you can create a for loop

for (item in arrayOfItems){
     console.log(item, "your refrence")
     emailFromItems = arrayOfItems[item].email
     if (comparisonNode.email == emailFromItems){do stuff}
}

The only issue here is that it will keep looking at the 0 item of incoming data.
I use the “Split Into Batches” node allot for this reason.

Then I would probably use an Http Request and a Webhook trigger to pass that data into a singleton.

1 Like