Sorting
To set the sorting order of query results, include the <hint> tag.
MDE supports the primary and secondary sorting of result elements. The primary sorting order is set by using the query <hint> tag. The secondary sorting order is set to a default based on the primary.
If no hint is set in the query, the default for sorting is resource in ascending order.
Only one query hint must be set. The following is the content for
the <hint> tag:
- ascending(resource)
- Query results are given by a primary sort resource in ascending order. The default secondary sort is by time in ascending order.
- ascending(time)
- Query results are given by a primary sort time in ascending order. The default secondary sort is by resource in ascending order.
- descending(resource)
- Query results are given by a primary sort resource in descending order. The default secondary sort is by time in descending order.
- descending(time)
- Query results are given by a primary sort time in descending order. The default secondary sort is by resource in descending order.
- includeNearRealTime
- Causes any other query hint to be ignored and enforce ascending(time) sorting,
which by default means that the secondary sort is by ascending resource.There are three requirements for the NearRealTime query to work.
- The query must retrieve raw data
- The query must include the NearRealTime hint.
For example:<hint>includeNearRealTime</hint>
- The current time must be between the start time and the end time.
The end time must be at least 2 hours more than the current time. For example: If the current time on the Mass Data Extraction client/server is Mon May 07 16:55:33 BRT 2012. Then,
StartDate: 2012-05-07T16:50:00-0300 EndDate: 2012-05-07T19:00:00-0300Note: Ensure that the Coordinated Universal Time used in the start and end times must be relative to the timezone configured on the Mass Data Extraction client/server.
If resource is set as the primary sorting hint, then time is set as the secondary sort by default. If time is set as the primary sorting hint, then resource is set as the secondary sort by default.