Enriching Data out of a DB and Looping through Items

image

I am trying to enrich data and loop through a workflow but I cannot seem to get this to work.

I have the following Node structure so far

  1. SQL Node → 2) Google Function that crawls a page and extracts data → 3) Merge → 4) SQL upsert → 5) SQL (execute query) 6) IF json.remaining is greater than 0 and I then have it looping back to the beginning.

This isnt quite working as I intend. I want to run this process and have it loop through 50 items at a time and continue running until IF = FALSE

I can run this once but it doesn’t actually loop

When I start the SQL node at the beginning it wont do anything if its got another node coming back into the beginning of it.

Information on your n8n setup

  • n8n version: 1.57
  • Database (default: SQLite): mySQL
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud

Hey @brian08723 , it sounds like you are looking for Loop Over Items (Split in Batches) | n8n Docs. Loop node allows you batch the items (50 items at a time if needed). You might not need IF node in the loop.

Ive tried the loop over items and cant quite get it to work either, any ideas what I might be doing wrong? When I run this node by node by the time it circles back its not grabbing the next 50.

@ihortom

Hey @brian08723 , your loop doesn’t look right to me. I would expect something like this

cool, let me wrap on that a bit and see where my logic broke down. :space_invader: