Add calculated column from values of an item to that item

Hello,

I would like to add a column per item in an item list which is a calculated value between two columns I paste an API response as an example. I think a good approach would be to use the Function node, loop the items object and get the values and then divide them. In the example shared workflow I would divide tvl/cmcId and set this value in a new attribute / column.

Please share the workflow

{
  "nodes": [
    {
      "parameters": {
        "url": "https://api.llama.fi/chains",
        "options": {
          "splitIntoItems": true
        },
        "queryParametersUi": {
          "parameter": []
        }
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        320,
        260
      ]
    }
  ],
  "connections": {}
}

Thanks!

Add a function item node with the following code.

item.calculation = item.tvl/parseInt(item.cmcId)
return item
Example workflow
{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        -440,
        200
      ]
    },
    {
      "parameters": {
        "url": "https://api.llama.fi/chains",
        "options": {
          "splitIntoItems": true
        },
        "queryParametersUi": {
          "parameter": []
        }
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        -140,
        200
      ]
    },
    {
      "parameters": {
        "functionCode": "item.calculation = item.tvl/parseInt(item.cmcId)\nreturn item"
      },
      "name": "FunctionItem",
      "type": "n8n-nodes-base.functionItem",
      "typeVersion": 1,
      "position": [
        160,
        200
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "FunctionItem",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Thanks! One last thing! I would like that the calculated field named mc/tvl. Is it possible?

item["mc/tvl"]= item.tvl/parseInt(item.cmcId)
return item