Use filterByFormula within Airtable

I’d like to make a filterByFormula API request within Airtable to return a list array of record IDs that match my query based on the field inputs in a record from a separate table. Ideas?

It’s similar to the Vlookup discussion.

First build your formula in the Airtable user interface. Then adapt the formula in your code to take variables.

Note that the REST API will return complete records, not just record IDs.

Should I use Axios, JavaScript Fetch, something else, or it doesn’t matter?

It doesn’t matter. Use what you are comfortable with.

BTW, you are using the REST API, from outside of the Airtable user interface, right?

I’m interested in using the API within the scripting block unless there’s an easier way. A feature that allows filterByFormula without scripting would be even better. It would make sense for it to be a separate tool.

As you can tell I’m limited in my coding knowledge, but if I have a clear example to work from, I can learn faster.

filterByFormula is available only when using the REST API, which is typically only used from outside the Airtable user interface. It is only used in Scripting block if you need to access a different base.

Scripting app has no equivalent for filterByFormula. When you select the records, you get all of the records. Then you must use JavaScript to filter for the records that you want.

Let’s say I want all the records of a particular user for a particular category. How would I get a count for all the records that match a set of criteria given by filterByFormula in an API request?

If you are working within Scripting app for data in the same base as the code, you do not use filterByFormula. filterByFormula is specific to the REST API, and the REST API is very slow and has many limitations compared to Scripting app. Using JavaScript to filter records in Scripting App is far quicker than trying to use filterByFormula in the REST API.

The exact method of getting the records you want depends on your base design. Do you have a table of users, or are your users Airtable collaborators? Do you have a linked record field that you can leverage to identify the records you want?

By the way, if you have budget for more personal advice for your specific base design, I am available for hire.

Essentially I want to load API requests into a separate table as new records with the person’s info to authenticate their request. Then I can use that request with the information about how they want to filter their data to return an array of matching record IDs that I can then use to populate the list.

Does that make sense? I can do a screenshare with you.