I'm trying to do some simple filters on Airtable API queries, and getting INVALID_FILTER_BY_FORMULA
errors. I can't find much docs on this.
How can I do an AND
type filter?
All the below are failing!
filter: "NOT({imageStatus}='rejected' "
// filter: "NOT({name} = '')"
// filter: "{status} = 'test-1' AND {renderStatus} = NOT('OK') }",
// filter: "NOT ({renderStatus} = 'OK') ",
// filter: "{renderStatus} = NOT('OK')",
update: found out a not is simply {status} != 'none'
but any other cheat sheet examples would be nice
AT docs are very poor on this:
You can filter the records from 'YOUR_TABLE_NAME' where the {status} field is equal to 'test-1' AND the {renderStatus} field is not equal to 'OK'. You can also use the "!=" operator instead of "NOT" to indicate "not equal to".
const Airtable = require('airtable');
const base = new Airtable({ apiKey: 'YOUR_API_KEY' }).base('YOUR_BASE_ID');
base('YOUR_TABLE_NAME').select({
filterByFormula: "AND({status} = 'test-1', {renderStatus} != 'OK')"
}).firstPage((err, records) => {
if (err) { console.error(err); return; }
records.forEach(record => {
console.log('Retrieved', record.get('name'));
});
});