Help

Re: Issue while detecting empty cells using Airtable REST API

2573 0
cancel
Showing results for 
Search instead for 
Did you mean: 
RSk
6 - Interface Innovator
6 - Interface Innovator

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?

RSk
6 - Interface Innovator
6 - Interface Innovator

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?

RSk
6 - Interface Innovator
6 - Interface Innovator

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?

RSk
6 - Interface Innovator
6 - Interface Innovator

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?

RSk
6 - Interface Innovator
6 - Interface Innovator

image

image

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