Inside a loop: use output from outside the loop

Describe the problem/error/question

I would like to search and upgrade Airtable records. I search them and then start a loop, but for me to upgrade each record, I need the id form the search node, previous to the loop over item one.

The idea is to search item in a table, loop over them, search something related in another table and, if something is found, update the original record.

I don’t know how to use the output from previous node. I tried this:

{{ $('Loop Over Items').first(1, $runIndex -1) }}

But didn’t work.

Please share your workflow

Information on your n8n setup

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

hello @giacomolanzi

Try this one. First won’t work.

{{ $('Loop Over Items').last().json.id }}
2 Likes

Thanks, it worked!

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