Sum data of set [SOLVED]

Hi,

I am trying to achieve a sum of digital data that I obtain via a set. (see capture below).

Could you guide me how to do this?

Thank you :slight_smile:

It’s resolved :slight_smile:

The solution is :

{
  "nodes": [
    {
      "parameters": {
        "functionCode": "let total = 0;\n\nfor (const item of items) {\n  total = total + item.json.points\n}\n\nreturn [\n  {\n    json: {\n      total,\n    }\n  }\n]\n"
      },
      "name": "Function1",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        540,
        930
      ]
    }
  ],
  "connections": {}
}
2 Likes