Help

Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here

Not able to use filter by formula (filterByFormula) in node.js (javascript)

809 2
cancel
Showing results for 
Search instead for 
Did you mean: 

Hello,

I am new to API and node.js and I was trying to use filterbyformula for checking if an passcode (from airtable) matches with a local variable (inside the javascript file). But I am not understanding why I am getting value as undefined.

This is the table snip.
passcode snip



// Airtable variables
var Airtable = require('airtable');
var userRecord = new Airtable({apiKey: "xxxxxxxxxx"}).base("xxxxxxxx");
var Users = userRecord("Users");

var Local_passcode = '123346';

async function SendOtp() {
    const records = await Users.select({filterByFormula: `{Passcode} = "${Local_passcode}"`}).firstPage(function(err,records) {
        if(err) {
            console.log(err);
            return;
        }
        return records[0]
    })

    console.log(records);
}

SendOtp();


Can anyone help me on this?

Thanks in advance!!

2 Replies 2

Hello,

Just solved the issue the data type of the passcode was not string so that’s why the error was occurring.

Sneh.

Thank you for sharing the solution. However, in your screen capture, it does look like the passcode is a string. Was there more going on?