I’m trying to understand the behavior of the new Split In Batches node with nested loops. In my example workflow I’m using the n8n training node to get 2 items, split them into batches of 1 (outer loop), then get 5 more items and again split them into batches of 1 (inner loop).
The bottom route uses the old nodes and runs as expected. No Operation node runs 5 times for the first item and 5 times for the second item of the Customer Datastore (n8n training) 1 node.
The upper branch uses the new nodes and runs 5 times for the first item of the Customer Datastore (n8n training) 2. I can’t really explain what’s happening next. Note that I can’t reset the inner Split In Batches 1_2 node the same way as the old nodes - the workflow then runs infinitely.
What is the error message (if any)?
Please share your workflow
Share the output returned by the last node
Information on your n8n setup
n8n version: 0.224.4
Database (default: SQLite): SQLite
n8n EXECUTIONS_PROCESS setting (default: own, main): own
Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
Hi @antitalent, this seems like an intentional change to me. Nested loops are often really hard to read, so the built-in “merging” of the new node version hopefully means you no longer nested loops and can simply build sequential workflows instead.
You can still keep using the old node version though if you prefer, simply copy it from your previous workflows to your new workflows.
Have 150+ wfs, in a single instance, using the Split in Batches node and around 1/3 of them using nested loops.
Note: In almost all of these wfs, i don’t need the ‘merged’ output. I just need to process each output item / nested output item of the Split in Batches node in its own separate loop (not always in a sub-workflow), equivalent to a for loop (the original purpose of this node i suppose).
Sure, sub-workflow is an option, but it’s not always the best alternative (particularly in view of the current UX).
This is a bit disconcerting for me.
Could you please share more as to why one of the core functionalities has been discarded/broken without any suitable alternative?
Because, from my experience and for programming in general, nested loops/foreach are indeed a fundamental entity, regardless of the Development tool being ‘visual-based’/‘low-code’/‘no-code’ etc.
Also, maintaining a repository of ‘old nodes’ doesn’t seem to be a very sustainable choice either. As there’s no official support/maintenance for them beyond a particular release, as well as it’s not really very convenient to maintain a private collection of old nodes.
Sorry, probably misunderstanding something. But from my understanding would you remove the IF-Node (which you used in the past to know when then loop is done), use the “done” output of the Split In Batches node instead and if you do not need the combined data which that node outputs by default, simply ignore it.
If that is not helpful please tell me what the problem with the above approach is so that I can provide a different answer or we can change the node to make that possible. Thanks!
I still have a note to look into this in more detail I just need to find a bit of time. Looking at your workflow in the old version you would use the reset option which doesn’t seem to be working in the same way in the new version so it sounds like that is a bug that needs to be resolved.