workflows.fit
Back to n8n workflows
n8n templateFreeBy Tom

Count the items returned by a node

This workflow provides a simple approach to counting the items returned by a node. It uses a Set node with the Execute Once option: ![image.png](fileId:704) The expression uses $input.all() (documented [here](https://...

Core NodesManual TriggerN8n Training Customer DatastoreSet
Loading interactive preview...

Template notes

This workflow provides a simple approach to counting the items returned by a node.

It uses a Set node with the Execute Once option:

![image.png](fileId:704)

The expression uses $input.all() (documented [here](https://docs.n8n.io/code-examples/methods-variables-reference/)) to fetch all incoming items at once, and .length (documented for example [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/GlobalObjects/Array/length)) to count them.