Help

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

Regex_match API and FilterbyFormula

185 0
cancel
Showing results for 
Search instead for 
Did you mean: 

I have an Airtable Database with Fieldname (“Expense”) and values. I am trying to write a JS code to query if user input available in this database. Here is what I got so far. Appreciate help in getting the RegexMatch / FilterbyFormula work. Thank you!

var Airtable = require('airtable');
var base = new Airtable({apiKey: 'myAPIkey'}).base('myAirtablebase');
var expenseCat = base('Imported table'); //name of the table

function matchDemo(airtableField, testString) {
console.log(airtableField,testString); // output works correctly "Expense Ikea"
const records = base('Imported table').select({filterByFormula:`REGEX_MATCH({${airtableField}},"${testString}")`}).all(); 
    return records;
    console.log(records);
};

matchDemo("Expense", "ikea"); // sample call to check if use input "ikea" is available in the Database

0 Replies 0