Sort Objects

The sort objects are used to sort the query result.

They can be dimensions, attributes or measures. Result objects can be used as sort objects. This mainly depends on the query capabilities of the universe.

The query specification model defines sort objects by using the <sortObject> XML element.

<sortObjects>
    <sortObject id="string" path="string" sortType="Ascending|Descending"/>
<sortObject> Attribute Description
id The object identifier, as defined when retrieving the data source metadata
path The full path of the object in the universe
sortType Is either Ascending or Descending

Example

The following snippet of a query specification shows the sort objects used in the query. Two of them are also defined as result objects.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<query xmlns="http://www.sap.com/rws/sl/universe" id="9168123992538053733" dataSourceType="unx" dataSourceId="5808">
    <querySpecification version="1.0">
        <queryOptions>
            ...
        <queryOptions>
        <queryData>
            <resultObjects>
                <resultObject path="Product|folder\Category|dimension"
                    id="_IB8eG7IhEeCk0Ylv-tlF2Q"/>
                <resultObject path="Product|folder\Product|dimension"
                    id="_IB8eGbIhEeCk0Ylv-tlF2Q"/>
                <resultObject path="Time|folder\Calendar|folder\Calendar Year Month|dimension" 
                    id="_IBo8G7IhEeCk0Ylv-tlF2Q"/>
                <resultObject path="Inventory|folder\Stock Level|measure"
                    id="_IB8eFrIhEeCk0Ylv-tlF2Q"/>
                <resultObject path="Product|folder\Minimum Stock|measure"
                    id="_IB8eHrIhEeCk0Ylv-tlF2Q"/>
            </resultObjects>
            <sortObjects>
                <sortObject sortType="Ascending" path="Product|folder\Category|dimension"
                    id="_IB8eG7IhEeCk0Ylv-tlF2Q"/>
                <sortObject sortType="Ascending" path="Product|folder\Product|dimension"
                    id="_IB8eGbIhEeCk0Ylv-tlF2Q"/>
                <sortObject sortType="Descending" path="Time|folder\Calendar|folder\Calendar Week
                    |dimension" id="_IBo8HLIhEeCk0Ylv-tlF2Q"/>
            </sortObjects>
        </queryData>
    </querySpecification>
</query>