Can I apply a filter from a custom app?

I’m working on an app that needs to filter the table in some way. It doesn’t look like there is a way to update the filters in the app. Is this correct?

Welcome to the community, @JoJo! :smiley: Are you writing a custom app, or just a script that runs in a Scripting app in the Apps sidebar? Could you please provide more details about your specific situation? Your question is currently pretty broad.

Thanks for the reply, Justin! Yes, I’m creating a custom app. It needs to filter the records in a table somehow. I looked for apps that do this, but couldn’t find one. They seem to recreate the table inside the app in full-view mode. Is this this the only approach?

If you get a Table instance from a base, there are methods on the table instance (selectRecords() and selectRecordsAsync()) that will let you get a RecordQueryResult. This has a records property that will return an array of all records on the table. From there you would use the standard JavaScript filter() method on that array to filter them as desired.

All of this is very similar to how you’d retrieve and filter records in other scriptable parts of Airtable, though the API is slightly different (and more robust). If you’re not already referring to the custom app API docs, I strongly recommend bookmarking it for future reference.

1 Like

I see – that’s what I had suspected. In that case, I need to recreate the table view in my app.

Sorry if I misunderstood something. Are you trying to change the actual table filters; i.e. the filters that drive a view? If so, those can’t currently be accessed—read or written—via any of Airtable’s scripting or app APIs.

1 Like

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.