How can I access data from a distant node?

Describe the problem/error/question

In the first code block, it works; I can successfully search for a value in my array.

Please share your workflow

However, I can’t get it to work in the second block, where there’s an intermediate block. I don’t know how to reference the result of a node located further down in the in an absolute way.

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.72.1
  • Operating system: ubuntu

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:

Hey @presta_melt, you can reference the Previous node data using {{ $('Previous node name').item... }}.

1 Like

Oh sorry I meant how can I access data from a distant node? (Not just the previous one)

most of the time {{ $('Previous node name').item... }} work to access nodes even as far back as the trigger. but sometimes it isn’t able to get it, like if there are different branches of the workflow that converge back, in that case, use a merge node (combine by position)

that looks like this

This works most of the time

But usually you can do as @Ruslan_Yanyshyn mentioned like this

and the last node looks like this

2 Likes

TY both of you for taking time to help me. :grinning:

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