my mind is still weird, I just need a little inspiration from good mind like yours
Describe the issue/error/question
Function3 take all from Set. But I want only what in the loop.
So 3 times, 3 items.
Function 3 give me; 3 items, 6 items and 9 items (cumulative answers)
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.
Tbh I think I am a bit lost here. Perhaps we can take this step by step.
For the first iteration of the outer loop, which data exactly do you need to send over to the child workflow (or sub-loop)? And how would the data for second iteration look like?
My current example sends these items over for the first iteration to the child workflow: