Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Issue while detecting empty cells using Airtable REST API

Topic Labels: API
646 10
Showing results for 
Search instead for 
Did you mean: 

Hi, I’m writing a program in Node.js using AIrtable API that fetches the record from Airtable and sends it to WhatsApp. The problem I’m facing is that for example, there are three columns

COL1 | COL2 | COL3

I’m trying to achieve that if any of the columns are empty, it skips that one and moves on to the another.
But when I execute col1 == null || col1 == undefined it returns false. This statement returns true only for the last column.

Also when I execute col1.length it returns 1 but for the last column, it returns Cannot read properties of undefined (reading 'length')

I don’t understand why the empty cells/ column before the last one doesn’t return undefined.

10 Replies 10

What is the field type of each column?
Can you see the actual value of the field?
Is it possible that the field looks empty but actually has a value?
For example, could the field have a single space character?

All the fields have long text as their type and no I checked all the fields are same as the last one.
But only the last one returns undefined rest of them returns length as 1.

Are any of them lookup fields?
Do any of them have rich text formatting turned on?

No to both questions

What are the actual values? Have you used console.log to see their values?

If you use scripting from within the base, what are the actual values?

Yes I have

Col 1 and Col2 log return a blank and length 1
Col 3 returns undefined.

What do you mean by “a blank”? What is the data type? (Blank is not a data type.) Is it a blank string? Is it an array? Is it a string with a single white space character, such as a space, a tab, or a new line?

It really looks like the value is a text string with a single space character.

Idk why, but I duplicated the table and records, works fine now, Thank you for your time and assistance.