''Sort'' Function

Top  Previous  Next

Sort function is used to sort the item nodes of the given ADOM according to the given sort criteria.

Syntax:

Sort(adom-sope:adom-name, sort-criteria)

 

adom-scope

The scope of the ADOM. Values are "r" Request, "s" Session and "a" Application.

 

adom-name

The name of the ADOM.

sort-criteria

Sort Criteria Syntax:

node-name,sort-order,value-is-number [; node-name,sort-order,value-is-number ... ]

 

node-name

The name of the node to be used as the sort key

sort-order

Valid values: "a" or "asc" (ascending order), "d" or "desc" (descending order).

value-is-number

"true" or "1" indicates that the value type of the sort key is number.

 

Examples:

Sort(s:cart, 'PRICE,asc,true')

Sort the nodes of  session ADOM "cart" according to the PRICE node in the ascending order. The values of node PRICE nodes are numbers.

Sort(r:employees, 'DEPARTMENT;SALARY,desc,true')

Sort the nodes of request ADOM "employees" according to first DEPARTMENT node in ascending order then according to SALARY node in descending order. The values of node SALARY nodes are numbers.