Help with Looping and Postgre

Hello guys! I’m new here… I’m trying to do a loop to make a large number of requests, so I’m dividing it into several parts to make it simpler!

How do I send an offset dynamically after updating it in the last “Code” node?

Basically I want to do: I have 1000 items in Postgree, I need to make 1000 requests, 1 for each piece of data, so as not to be cumbersome I am making requests in a loop every 10 times! and making a query

LIMIT 10 OFFSET $1

But I don’t know how to do this correctly

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

Welcome to the community @Lucas_Fernandes1 !

Tip for sharing information

Pasting your n8n workflow


Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.

```
<your workflow>
```

That implies to any JSON output you would like to share with us.

Make sure that you have removed any sensitive information from your workflow and include dummy or pinned data with it!


I’m not quite following your workflow and the loop you showed. Could you share the actual workflow as opposed to the screenshot?

What is the purpose of HTTP Request node? What does Code node do toy your data?

If your have record’s IDs (primary key), you do not need any offsets to update those records as you would address them directly.

I’m starting now on n8n! my idea is to bring the data from postgre, divide it into packages and do an action for each line to send a message (here the https request comes in)

Basically I have the total number and the loop I want to do is this value

example: I have 1000 records and I will make requests every 100, the looping would run 10 times, the code updates the value of my offset which starts at 0 and increases from 100 to 100

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.