Merge, in a loop, plays only once

Describe the problem/error/question

I need to make a loop and to merge (multiplex) items in the loop with a list of items external of the loop
But the merge plays only once

What is the error message (if any)?

No error message, the workflow ends correctly

Please share your workflow

Share the output returned by the last node

The result shows only one loop

Information on your n8n setup

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

@ppcm , the behavior of your workflow is correct and expected.

  • If you are merging in Multiplex mode why do you need to loop back again?
  • When you loop back what data you expect to be merged with?

Note to the 2nd quest: when you loop back there is nothing to enter at the input one with the 2nd iteration of the Merge node.

If you want to merge with “The common value to merge” mode you need to initiate it yet again. This could be done like this, for example (not sure if that is what you are after).

1 Like

@ihortom Thanks for the answer
Of course, you understood, this a dummy example :wink: In real life, this example is unsuful, but it permit to understand quickly the need

You proposal works like I need. Great
But now, I need to understand why. Does it mean, if I need to loop on nodes, the flow need to pass, on each loop, over all their branches?

@ppcm ,

Does it mean, if I need to loop on nodes, the flow need to pass, on each loop, over all their branches?

Yes, if we are talking about looping back to Merge node. Each iteration is a separate execution of the node. Think of it as a function with two required arguments. The 2nd iteration is the 2nd call of the function. If you provided a value for one argument, you also have to do the same for the 2nd argument to run that function.

Generally speaking, looping is a broad term. There are other ways of looping you might consider when deciding to engage iteration, such as

  • pagination whether embedded in later version of HTTP Request node or as a separate part of the workflow
  • looping with either Loop node (newer version) or Split In Batches older node

It is clear, thanks

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