Overview

AQS provides you with a sorfInfo object that you can use to organise the output of a query.

Query and join root nodes accept the sortInfo object that contains sorting information. It is possible to source on an attribute or an item property belonging to the root context. Only the following types of attributes can be used to sort a query:

  • boolean
  • date
  • time
  • seasonal
  • number
  • datetime
  • string

Using any other types of attributes will return an error.

The sortInfo object has the following structure:

Property Name Type Required Description
attributeCode string false The code of the attribute to sort on
itemProperty string false The item property to sort on
sortOrder "ascending" or "descending" false It can either be ‘ascending’ (default) or ‘descending’
Note

The attributeCode and itemProperty are mutually exclusive. If attributeCode is provided then the output will be sorted on the code of the attribute, else if itemProperty is provided the the output will be sorted on the item property. If neither property is provided then no sorting will occur.

The following examples illustrate the use of the sortInfo object within a query.

Example Sorting on Attributes

{
  "type": "Query",   // "The root node type"
  "properties": {
    "dodiCode": "designInterfaces_streetLightingUnits" // "In this case the design is being specified by using its dodiCode"
    "attributes": ["all"],
    "sortInfo": {
      "attributeCode": "attributes_streetLightingHeights",
      "sortOrder": "Ascending" // Default
    }
  }
}

Example Sorting on item properties Last Edit Date

{
  "type": "Query",   // "The root node type"
  "properties": {
    "dodiCode": "designInterfaces_streetLightingUnits" // "In this case the design is being specified by using its dodiCode"
    "attributes": ["all"],
    "sortInfo": {
      "itemProperty": "LastEditDate",
      "sortOrder": "Descending"
    }
  }
}