Input.all() but for 2 nodes back and so on

is there a way to get the $input.all() but for the 3 nodes back node and so on?

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:

Yes

$('nodename').all()

1 Like

Solution: Use $node["Node Name"].all() to access data from any previous node by its name, regardless of position in the workflow.

Example:

// Get all data from a specific node (3 steps back or any position)
const threeNodesBack = $node["Your Node Name"].all();

// Process that data
return threeNodesBack.map(item => {
  return { json: { processed: item.json.someValue } };
});

This works for any node in your workflow - just replace “Your Node Name” with the actual node name you need to access.

@Yo_its_prakash Don’t think that actually works.
The “all()” is only possible with the new way of referencing data from other nodes, if I recall correctly :wink:

That’s absolutely right @BramKn, But @Janna.greenway and I where discussing another problem in another comment, from that i got to know the version of n8n @Janna.greenway is using support the way i suggested, Thanks though i will keep that in mind.

What version is that? As it should never have worked if I recall correctly. This is due to the way this reference works.

I think the old reference is the same as $('nodename').item.json
The new way of referencing allows all the other funky things like all() and first().

Give me a moment let me go back and check, i could gravely be wrong if it is thanks for the clarification


this is a sample, but assume the inputs for all previous node is a json or array with many variables. I wanted to add all inputs from all 3 previous nodes in different variables in code but i need the .all(). is there a way to .all() but for first node, second node, etc. ?

$(“NODENAME”).all()

1 Like

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