Output data from the last node run

I tried to understand the docs on this but couldn’t get my head around it.

How can I get all output items from a node from it’s last run. I don’t know in advance how many times the node will run.

Does $('<node-name>').all() always return the items of the last run from that node?

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:

@renetheastronaut , I believe what you are looking for is $('<node-name>').last().

1 Like

Hey @renetheastronaut,

You got it so $('node-name').all() will return all output items from a node, If you wanted the first item you could use .first() and for the last item it would be .last().

If the node is following the node you want the output from you can just use $json.x then the auto looping will kick in but if it is 2 or 3 nodes back and you want to use the inbuilt looping for items you would use $('node-name').item.json.x

1 Like

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