Null output

Hi everybody

In my case:

  • I want to add an ID to new row in google sheet.
  • I generate a random ID by “function” node.
  • search my table in google sheet to find that I have that generated id or not by google sheet" node.
  • if there isn’t that id I create new row with that random id.

my problem is:
after search my table in google sheet (by lookout in google sheet node) how can I use null output in “if” node.
How can I use something like this:
if search results = 0 then true

Update:
I think One Option is add “empty” and “not empty” in string in “if” node.

Sorry to hear that you have problems!

Checking for an empty item is possible like this:

{
  "nodes": [
    {
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{!!Object.keys($node[\"Google Sheets\"].data).length}}",
              "value2": true
            }
          ],
          "number": []
        }
      },
      "name": "IF",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        650,
        250
      ]
    },
    {
      "parameters": {},
      "name": "Got Result",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        850,
        150
      ]
    },
    {
      "parameters": {},
      "name": "No Result",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        850,
        350
      ]
    },
    {
      "parameters": {
        "operation": "lookup",
        "sheetId": "",
        "range": "A:C",
        "lookupColumn": "Name",
        "lookupValue": "Jan",
        "options": {}
      },
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 1,
      "position": [
        450,
        250
      ],
      "credentials": {
        "googleApi": ""
      }
    }
  ],
  "connections": {
    "IF": {
      "main": [
        [
          {
            "node": "Got Result",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "main": [
        [
          {
            "node": "IF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Thank you @jan
Is this just for strings or I can use it for numbers too?

Should work for everything. All the expression does is to check if the item returned from the node contains any data.