Hi @Dtneo, from looking through this it’s not clear to me what the loops are achieving here. But on a general level my first suggestion would be to move the inner loop into its own sub-workflow. So something like this for the parent:
And a child workflow like so:
This way you wouldn’t have to wrap your head around building nested loops and resetting them correctly.
That’s because I am not 100% sure what’s expected here. Which data do you want to process in the child workflow (or the sub-loop if you will) and which format exactly do you want the sub-workflow to return for each batch coming from the parent?
You should be able to make adjust the examples accordingly. You can also consider temporarily adding some mock data to the child workflow using the Function node (or Code node if using the latest version of n8n), this should make it much easier to build out the required logic.