Split in Batches don't take every datas that are input

Hello, I share you my workflow because I have an issue and I don’t understand.
The goal of this workflow is to get some parents object and to update the children object related to a code. But in the “split in batches” nodes the input datas are not all taken as you can see in the picture below. I can’t share the workflow for some confidential reasons, but here is an example of my workflow when I execute it.

Hi @bendcst, welcome to the community :tada:

Seeing you can’t share your workflow my best guess is that you might be using an unsuitable conditions on your IF nodes to determine whether to continue or end the loop.

That said, nested loops can be incredibly confusing and personally I would avoid them at all costs. Perhaps you might simply want to move your inner loop into a separate workflow and call it via the Execute Workflow node? This way, each of your workflows (parent and child) have only one loop, making them much easier to handle.

Hi @MutedJam, thank you four your reply !
My IF nodes are simply “{{$node[“loopOnCodicList”].context[“noItemsLeft”]}}” and “{{$node[“Split In Batches”].context[“noItemsLeft”]}}”.
I will try to make 2 separates workflows, thank you for your help.
However, in the past, I had a problem with the node Execute Workflow, I couldn’t recover datas of the first workflow in the second. Do you know if is it possible ?

However, in the past, I had a problem with the node Execute Workflow, I couldn’t recover datas of the first workflow in the second. Do you know if is it possible ?

Yes, this works, but’s a bit tricky. The Execute Workflow node in your parent would pass on all items it receives to the Execute Workflow Trigger node of your child workflow.

So if your parent looks like this:

…and the child workflow looks like this:

The Execute Workflow node in your parent would receive this input data:

The Execute Workflow Trigger node in your child workflow would then use this as its own output as well:

The last node in your child workflow would then return its own data back to the parent.

For development purposes (while building your workflows) you can use the data pinning feature in n8n to simply hard-code any test data you’d like to use.

Thank you, I will try your solution. I’ll come back to you to give you an update.

1 Like

It worked ! Thank you so much @MutedJam !

1 Like

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