How to check for when Airtable Find Records returns no records

Hi,

I have a workflow where the node is Find Records for Airtable based on a filter. If it doesn’t find a record it should Create record. However, in my IF node I’m unable to check for this condition.


What parameter should I be checking for?

Regards,
Ruchika

Turn “Always 0utput Data” on and check if the json is empty. Check the example below.

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "operation": "list",
        "application": "appKUpd1rLmDvMCeZ",
        "table": "Movies",
        "additionalOptions": {
          "filterByFormula": "FALSE()"
        }
      },
      "name": "Airtable",
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 1,
      "position": [
        540,
        300
      ],
      "alwaysOutputData": true,
      "credentials": {
        "airtableApi": "[email protected]"
      }
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{$json.length > 1}}",
              "value2": true
            }
          ]
        }
      },
      "name": "IF",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        750,
        300
      ]
    },
    {
      "parameters": {},
      "name": "NoOp",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1020,
        210
      ]
    },
    {
      "parameters": {},
      "name": "Airtable1",
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 1,
      "position": [
        990,
        440
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Airtable": {
      "main": [
        [
          {
            "node": "IF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF": {
      "main": [
        [
          {
            "node": "NoOp",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Airtable1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
1 Like

I selected Output Data in the variable selector, which shows up as empty, but seems to work. There needs to be a better way to do this. because if you see the Parameters, the Value 1 is empty, so it seems like nothing has been selected.


Hey @ruchikaabbi!

I have shared a workflow that might help: Add only new records to Airtable

Let me know if this doesn’t solve your issue.