This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v19.8
entitySelection.orderBy( )
|
entitySelection.orderBy ( criteria ) -> Result | ||||||||
Parameter | Type | Description | ||||||
criteria | Text, Collection |
![]() |
Text: attribute path(s) and sorting instruction(s) for the entity selection Collection: collection of criteria objects |
|||||
Result | EntitySelection |
![]() |
New entity selection in the specified order | |||||
The entitySelection.orderBy( ) method returns a new ordered entity selection containing all entities of the entity selection in the order specified by criteria.
Notes:
You must use the criteria parameter to define how the entities must be sorted. Two syntaxes are supported for this parameter:
"attributePath1 {desc or asc}, attributePath2 {desc or asc},..."
Note: Null values are evaluated as less than other values.
// order by formula
$sortedEntitySelection:=$entitySelection.orderBy("firstName asc, salary desc")
$sortedEntitySelection:=$entitySelection.orderBy("firstName")
// order by collection with or without sort orders
$orderColl:=New collection
$orderColl.push(New object("propertyPath";"firstName";"descending";False))
$orderColl.push(New object("propertyPath";"salary";"descending";True))
$sortedEntitySelection:=$entitySelection.orderBy($orderColl)
$orderColl:=New collection
$orderColl.push(New object("propertyPath";"manager.lastName"))
$orderColl.push(New object("propertyPath";"salary"))
$sortedEntitySelection:=$entitySelection.orderBy($orderColl)
entitySelection.orderByFormula( )
entitySelection.query( )
ORDER BY
ORDER BY ATTRIBUTE
QUERY BY ATTRIBUTE
Product: 4D
Theme: ORDA - EntitySelection
Created: 4D v17
4D Language Reference ( 4D v19)
4D Language Reference ( 4D v19.1)
4D Language Reference ( 4D v19.4)
4D Language Reference ( 4D v19.5)
4D Language Reference ( 4D v19.6)
4D Language Reference ( 4D v19.7)
4D Language Reference ( 4D v19.8)