Returning API data with sort order but without filters


#1

I’d like to query a table via the Javascript API with the following requirements:

  1. The query uses a “View” for sort order
  2. The query uses a custom filter that overrides any filters existing on that view.

Is it possible to accomplish this? Right now, it seems that filters in Airtable always affect the API results.


#2

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.


#3

If I create a new view, then I don’t get the sort order from the original view, right?


#4

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.


#5

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.


#6

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.


#7

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


#8

If we implement numbered ordering, we’d lose the nice drag-and-drop functionality which makes our workflow so fast.


#9

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?