The Presentation API includes several methods that you can use for record sorting.
Because a record sort request is simply a variation of a basic navigation request, rendering the results of a record sort request is identical to rendering the results of a navigation request.
However, there are specific objects and method calls that can be accessed from a Navigation
object that return a list of valid record sort properties, as shown in the examples below. (This data is only available from navigation and record search requests.)
The ERecSortKeyList
object is an array containing ERecSortKey
objects. Use these calls to get the ERecSortKey
sort keys in use for this navigation:
Each ERecSortKey
object contains the name of a property or dimension that has been enabled for record sorting, as well as a Boolean flag indexating whether the current request is being sorted by the given sort key, and an integer indexating the direction of the current sort, if any (ASCENDING
, DESCENDING
, or NOT_ACTIVE
).
The Navigation
object also has a method which provides an ERecSortKeyList
containing only the sort keys used in the returned results:
Note that in order to get an active sort key that is not precomputed for sort, you must use:
Example 10. Java example of methods that return sort properties
ERecSortKeyList keylist = nav.getSortKeys(); for (int i=0; i < keylist.size(); i++) { ERecSortKey key = keylist.getKey(i); String name = key.getName(); int direction = key.getOrder(); }
Example 11. .NET example of methods that return sort properties
ERecSortKeyList keylist = nav.SortKeys; for (int i=0; i < keylist.Count; i++) { ERecSortKey key = keylist[i]; String name = key.Name; int direction = key.GetOrder(); }