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:
- Sort by creation date (the date is in the JSON, but it is not a field you can use to sort)
- Sort by last modification date (I am not sure this date is available)
- 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.
- Sort on multiple fields. In my example: sort the orderlist by customer (first) and second on the creation date
Thanks for sharing your insights and requests, @knobel.
Regarding the individual points:
- Did you try adding a “Created On” field to the app? That could solve your issue.
- Same as 1. but with a “Last modified on” field
- 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.
- That is currently not possible - feel free to create feature request for that though in the usual way here.
Thank you &
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.
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.