Run down a tree for each item and collect results

Yes, you could consider using a Code node, I’ve shared one possible approach over here: [Merge node] merging multiple outputs - #4 by MutedJam

It might be easier/more readable for you to do something like this though:

  1. Move the tree logic into a sub-workflow
  2. Split your workflow in batches of 1 and run the sub-workflow for a single item at a time
  3. Create a single list from all batch items again afterwards (check Addition assignment (+=) operator with the Set node in n8n - #5 by BramKn for options)

So essentially one “parent” flow like this:

And one sub-workflow like so:

Hope this helps :slight_smile:

1 Like