How to sort by id desc with maxResults = 1

I searched within the community for sorting methods. The best example was using the object comparer.

But this is NOT what I need. I want to get the search result already sorted as if you add "ORDER BY ID DESC" to a SQL statement. If you need to load all the results the performance will be "a little bit" bad if you have "some few" entries as you can imagine. Translated into SQL I would like to perform:

SELECT TOP 1 * FROM myObjType WHERE condition AND condition ... ORDER BY id DESC

in order to load only the result matching all conditions and having the highest ID without loading all entries from server - even just one entry.

I didn't found any solution for that.

I need to re-implement the Sequence in the CK utilities because they only work on string based values and not for integer unfortunately.

Beside of that it would be needed for showing the first maybe 50 out of 10.000.000 search result perhaps ordered by creation date descending.

Parents
  • Hi Falk,

    Unfortunately our APIs do not currently support the ability to order the results.  Without this you cannot achieve what you want to do in an efficient way.  Depending on what you need to actually do, you may want to consider using something like Named Value Storage to hold highest IDs, then ensure that is maintained as objects are created.

    Regards,

    Craig.

  • It would be great if data could be sorted directly through SQL statements in object types. It is quite annoying that even though you try to order it by names it is still not shown in drop-down sorted. Also sorting by ID would sometimes be so useful. My up vote for this feature.

Reply
  • It would be great if data could be sorted directly through SQL statements in object types. It is quite annoying that even though you try to order it by names it is still not shown in drop-down sorted. Also sorting by ID would sometimes be so useful. My up vote for this feature.

Children
No Data