sortClause

The sort clause orders the results of a query. It can specify a direction (asc/desc) or a list of sort items, each with an optional direction.

Examples

Sort descending

from [Observation] O
  sort desc

Sort by a property ascending

from [Encounter] E
  sort by E.period.start asc

Sort by multiple properties

from [Observation] O
  sort by O.effective desc, O.id asc
Railroad Diagram
100%
sort sortDirection by sortByItem ,

scroll to zoom · drag to pan · click green rules or blue tokens to navigate

EBNF

sortClause
  : 'sort' ( sortDirection | ('by' sortByItem (',' sortByItem)*) )
  ;

Used In