Help

Can I apply a filter from a custom app?

Topic Labels: Extensions
Solved
Jump to Solution
2131 5
cancel
Showing results for 
Search instead for 
Did you mean: 
JoJo
5 - Automation Enthusiast
5 - Automation Enthusiast

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?

1 Solution

Accepted Solutions

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.

See Solution in Thread

5 Replies 5

Welcome to the community, @JoJo! :grinning_face_with_big_eyes: 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.

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.