Count total of an Airtable List per category

Hi,
I am trying to get the total count in a SET block to give me the total of rows of an Airtable List per category, I tried this:

But not working:

I use this table: Airtable - Movies

Where unique identifier is “name”. Thank you very much.

Something like below should do it. I used the Filter by formula parameter to filter the records by a particular category and then used a function node to return just the length. There might be other ways to achieve this, but I have barely any experience with Airtable.

  {
      "nodes": [
        {
          "parameters": {},
          "name": "Start",
          "type": "n8n-nodes-base.start",
          "typeVersion": 1,
          "position": [
            250,
            300
          ]
        },
        {
          "parameters": {
            "operation": "list",
            "application": "appKUpd1rLmDvMCeZ",
            "table": "Movies",
            "additionalOptions": {
              "filterByFormula": "IF(Category = \"Horror\", TRUE(), FALSE())\n\n"
            }
          },
          "name": "Airtable",
          "type": "n8n-nodes-base.airtable",
          "typeVersion": 1,
          "position": [
            570,
            300
          ],
          "credentials": {
            "airtableApi": "[email protected]"
          }
        },
        {
          "parameters": {
            "functionCode": "return [{ json: { count: items.length } }]"
          },
          "name": "Function",
          "type": "n8n-nodes-base.function",
          "typeVersion": 1,
          "position": [
            820,
            300
          ]
        }
      ],
      "connections": {
        "Start": {
          "main": [
            [
              {
                "node": "Airtable",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Airtable": {
          "main": [
            [
              {
                "node": "Function",
                "type": "main",
                "index": 0
              }
            ]
          ]
        }
      }
    }

Hi @RicardoE105 , thank you very much, I forgot to add the “count” in my condition :slight_smile: .

2 Likes