Updated version, since Airtable uses basic string matching, my above code would return both “Apple” and “Pineapple” on the query “Apple”. This fixes that
const query = { filterByFormula: `FIND(", ${categoryName}, ", ", " & ARRAYJOIN(Categories) & ", ...
This page was very helpful for me when using filterByFormula and the Airtable JS API.
The formula FIND("CATEGORY_NAME", ARRAYJOIN({Categories})) > 0 will return 1 if CATEGORY_NAME is found in Categories field.
Full JavaScript code example:
const airt...