Dec 28, 2021 02:40 AM
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.
// 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!!
Dec 28, 2021 10:07 PM
Hello,
Just solved the issue the data type of the passcode was not string so that’s why the error was occurring.
Sneh.
Dec 28, 2021 10:54 PM
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?