Looping, Pagination and SplitInBatches problem

Describe the issue/error/question

I am trying to find a user in Zoho based on a given email; unfortunately, Zoho doesn’t let me search by email, so I have to get a list of every user and then compare one by one until I find the one with the given email. So my idea is to load 100 users at a time, check the email of each user, then load another batch of 100 users, and so on.

Problem is that after the first run is complete (i.e., 100 users are loaded, split into batches of 1 and compared to the given email), I increase pagination and load the second batch of 100 users, but this batch is not passed onto the SplitInBatches node.

Can someone point me to where I might be missing out on something?

Please share the workflow

Share the output returned by the last node

As you can see, the total number of users that enter the Item Lists is 195, but only the first 100 is processed in the SplitInBatches node.

Where’s my mistake?

Information on your n8n setup

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

TIA

Hi @MarceloSchmidt

There is a boolean in the splitinbatch node this determines if it is done or not.
The second time it is done so it does not fire again.
Easiest fix would be to have the split in batch part as a subworkflow and execute that. This way it should have a separate workflow running for every page, making sure the boolean is correct when the split in batch is started.

Hope that makes sense.

Hey @BramKn thanks for the solution. I would prefer not having to split that into multiple workflows, but it works!

1 Like

Hello, I’m having the same issue from this topic.

Using the “.context[“noItemsLeft”]” the split in batches only runs in the first pagination loop…

I finally found the same problem that I have. I also have created post about this problem:

As @MarceloSchmidt mentions, yes, it works when you split executions into multiple workflows, but that means there is no way to run “Split in Batches” for every item from multiple executions?