SORT=FIELD[|DIRECTION]

SORTSET=FIELD_1[|DIRECTION];FIELD2[|DIRECTION]


Sort indicates in what order you would like your data to display. It is highly recommended to specify a sort because ToolZ’s underlying database engine doesn’t guarantee a sort order.


Sort takes a field to sort by and an optional sort direction.


Sort direction can be:

  • ASC - Ascending or smallest to largest. This is the default if no direction is specified.
  • DESC - Descending or largest to smallest.


The sort field can be:

  • A datapoint property
  • The result of a function
  • An attribute of a group member



Examples:

#datapoint property

{|LOOP|RESULT.DATAPOINTS(SORT=TRENDING_TIMESTAMP|DESC)}


#aggregate field

{|LOOP|RESULT.MONTH_OF_YEAR(SORT=COUNT(MONTH_OF_YEAR))}


#ranking

{|LOOP|RESULT.MONTH_OF_YEAR(SORT=RANK(COUNT(MONTH_OF_YEAR), DESC, OVERALL)|ASC)}


#group member name

{|LOOP|RESULT.DATAPOINTS(SORT=MONTH.NAME)}


#group member name and property

{|LOOP|RESULT.DATAPOINTS(SORTSET=MONTH.NAME;TRENDING_TIMESTAMP)}