Making reference to a data from previous node

Hello n8n experts!

I’m working on my own workflow to handle pagination. So I have a loop that iterates through a HTTP Request node that it stops once the get call is not getting more elements.

For testing purposes I wanted to add a condition in the if node in order to break the loop after page 4 (even if there is still elements being received).

The problem is that for some reason after the first iteration I’m no longer able to read the page we are in. I would like to understand why.

Thanks in advance for your time!

Information on my n8n setup

  • n8n version: 1.6.1
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): Default, own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Self-hosted k8s setup
  • Operating system: We use AWS, the OS is Amazon Linux 2

hi @Fortian

you don’t have ‘pages’, you have offset value, so the condition with 4 pages will never meet. That should work ( a little simpler). Or just replace the second condition with a page to ‘< 12’.

And do not even try to use strict ‘Not equal’ with that kind of stuff :slight_smile:

Hello @barn4k

You are completely right I should have spotted that. But my “issue” was that the expression was not working after the second iteration, I was getting the error message: [ERROR: Can’t get data for expression].

But I realised that it works just fine when I execute the whole flow but it doesn’t when I click on execute in the “If” node, why is that?

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