Sort options in API (and frontend)

When using the API (but also in the frontend) some options for sorting records are missing. Of course you can sort the results, but in our case we have too many records to do this and it would take several calls to load all data.

These options are requested:

  1. Sort by creation date (the date is in the JSON, but it is not a field you can use to sort)
  2. Sort by last modification date (I am not sure this date is available)
  3. Sort by related field: sort on the title, not on the records id. For example: We have a list of orders and we want to sort on the customer (related field). You can sort on this field, but it will be sorted on the recordid, not on the name. In my opinion sorting on the recordid is useless. In the frontend you can sort on the title of the related field, so this option is already there.
  4. Sort on multiple fields. In my example: sort the orderlist by customer (first) and second on the creation date
1 Like

Thanks for sharing your insights and requests, @knobel.

Regarding the individual points:

  1. Did you try adding a โ€œCreated Onโ€ field to the app? That could solve your issue.
  2. Same as 1. but with a โ€œLast modified onโ€ field
  3. Sorting should work the same in the web application and the developer API wherever possible. Let me double check that for you and come back here.
  4. That is currently not possible - feel free to create feature request for that though in the usual way here.

Thank you &
Cheers
Tim

I understand I can add these as fields, but created on is already in the data model (it is in the header of the API response) and I am not a fan for duplicated data.

Here what happens in the sorting based on a related field.

TableUsers:
1 Tim
2 Kees
3 Anna

TableIssues:
1 Some issue1, user= 1
2 Some issue2, user= 2
3 Some issue3, user= 1
4 Some issue4, user=3

Now trying to get the tableissues sorted on the user. The result will be:

Some issue1, user=Tim
Some issue3, user=Tim
Some issue2, user=Kees
Some issue4, user=Anna

Why? Because the record ID for Tim is lower. It is sorted on the recordid, not on the title.