Sep 18, 2018 06:02 PM
I’d like to query a table via the Javascript API with the following requirements:
Is it possible to accomplish this? Right now, it seems that filters in Airtable always affect the API results.
Sep 18, 2018 07:40 PM
No it can’t override the view filters. It would just filter within the view. But you could easily create a new view that doesn’t have your current views filter and query against that.
Sep 18, 2018 07:58 PM
If I create a new view, then I don’t get the sort order from the original view, right?
Sep 18, 2018 08:11 PM
you can set up the new view to use same sort as original, right?
You can also provide a sort in the api call to sort any way you want to.
Sep 19, 2018 07:41 AM
Our view sort is not formula-based, it’s based on manual reordering. Thus, even if the view is duplicated, it will not stay in sync with the “master” view.
Sep 19, 2018 07:43 AM
Also, the filtering is additive. So, although I can provide a filter to the API, it doesn’t replace the existing filter, hence my original question.
Sep 19, 2018 08:51 AM
why not add an ‘Order’ field that you modify manually with a number that corresponds with your manual sorting so that you can sort it easily in another view or via api sort functionality
Sep 19, 2018 09:05 AM
If we implement numbered ordering, we’d lose the nice drag-and-drop functionality which makes our workflow so fast.
Oct 28, 2018 10:06 AM
When a view is specified during an API request, all returning records will be contained in that view and any filterByFormula parameters will be applied/considered on records contained in that view.
However I’m still a little confused about what you’re trying to accomplish—it sounds like you want to fetch records using the manual sort order defined in by a view yet you want to retrieve records that are NOT contained in that view (by “overriding” the view filters with a custom filterByFormula). Even if you were to accomplish that, how would you anticipate the records from outside the view would be sorted in the results?
The only way I know to have the “best of both worlds” (i.e. a manual sort order from a view with all non-view records appended to then end) would be with two requests:
You could 1) request all manually sorted records from the view and 2) request all records from the table where AND(RECORD_ID() != ‘recXXXX’, RECORD_ID() != ‘recXXXX’, etc) …
What language are you using to connect with the API?