OpenWGA 7.10 - WebTML reference

WebTML tags » navigator

<tml:navigator order ="order-expression">

Purpose:

Determines the order in which this navigator will put out documents

Description:

The attribute "order" is an alternative to the "sort..." atributes like sortexpression or sortcomparison that is more performant and effective, especially when paging results, as the actual ordering is done by the database backend. Using order expressions OpenWGA does not need to load all documents from the database backend to determine just a page of the results in the right order (what is the case with "sorting"). However it still is a little bit less performant than retrieving pages in their natural order as it cannot use the cache.

Unlike the "sort..." attributes however you need to specify an order expression which is more limited in capabilities than sorting with TMLScript expressions. An order expression consists of a row of semicolon-separated order terms. Each order term consists of a field name and optionally an comma-separated flag list inside round brackets:

field; field (flag,flag); field

As field names you can use

  • Item names in lowercase
  • WebTML metadata field names for contents in uppercase, that are described as "orderable" in the metadata reference

The navigator will order its results by the given fields in the priority order of their appearance on the expression. This means that two docs whose first field on the expression is equal are ordered by the second field and so on.

A flag is an expression which modifies the ordering. It may consist of a single term or a term plus a value with an equal sign inbetween. The following flags are available:

  • desc - Sort in descending order. Omitting this will automatically sort in ascending order
  • ci - Case insensitive comparison for strings
  • type=text|number|date|boolean - The data type of an item, only necessary for these. Omission will let the navigator assume a string value.

Value(s):

An order expression like described above

Examples:

Some order expression examples. Ordering by title ascending:

<tml:navigator type="children" order="TITLE">

The same but this time case insensitive:

<tml:navigator type="children" order="TITLE(ci)">

Now also descending and order by the pages creation date as second priority without any flags:

<tml:navigator type="children" order="TITLE(ci,desc);PAGECREATED">

Ordering by item doctype (which contains a number what must be declared in the flags) in ascending order, then the pages publishing date in descending order:

<tml:navigator type="children" order="doctype(type=number);PAGEPUBLISHED(desc)">