Nested SplitInBatches does not work

Describe the issue/error/question

Splitinbatches does not works for multiple “Runs” (only works for the first one)

What is the error message (if any)?

No error message is showed, but the second run is not used by the “SplitInBatchesMessages” node

Please share the workflow

This is a Demo:

  1. 3 RSS url feed provided,
  2. This should be iterated by “SplitInBatchesRSS” node,
  3. and for every URL “RSS Feed Read” node should get “n” news,
  4. for every news: a message should be sent via telegram (a noOp node in this example) when finish,
  5. then restart the process with the next URL (back to step 3), but it only works for the first “run”

Share the output returned by the last node

There is no error

Information on your n8n setup

  • n8n version: 0.186.1
  • Database you’re using (default: SQLite): Postgres
  • Running n8n with the execution process [own(default), main]: queue
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Hey @jfcaringi, you could split this into two workflows to make it work the way you want it to. One parent processing the feeds and then calling the child workflow processing the individual entries.

Parent

Child

The child will run for each feed:

Thank you very much!

I was think about using webhooks too,

but, what I want to know:

  • is this a N8N issue? this is something that will be fixed in the future?
  • Is this a design limitation? nested SplitinBatches is not allowed?
  • or, am I dumb and cant understand how it works?

Thanks for your support!

To be honest, I don’t know if this is expected or a bug. Perhaps @sirdavidoff can elaborate on this?

Personally I try to avoid nested loops at all costs as they are a pain to read and debug in complex workflows. Using a Webhook node in your child flow and an HTTP Request node would have a similar effect as the Execute Workflow node from the above example.

1 Like

You need to use the reset function of SplitInBatches. It’s not totally obvious and could do with some documentation - Split In Batches - n8n Documentation

The key is changing the reset parameter in your SplitInBatchesMessages node to {{$node["SplitInBatchesMessages"].context["noItemsLeft"]}}. Once its batch of RSS messages has finished it resets the state of the node ready for the next set of RSS feed messages.

If you want to collate all the data afterwards, you’ll need to use a function node to merge the 3 executions together, see https://n8n.io/workflows/1160/

P.S. you’re not dumb :slightly_smiling_face:

3 Likes

thanks genious!
I really appreciate it!

have a great week!