This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v19.8
entitySelection.max( )
|
entitySelection.max ( attributePath ) -> Result | ||||||||
Parameter | Type | Description | ||||||
attributePath | Text |
![]() |
Path of the attribute to be used for calculation | |||||
Result | Mixed |
![]() |
Highest value of attribute | |||||
The entitySelection.max( ) method returns the highest (or maximum) value among all the values of attributePath in the entity selection. It actually returns the value of the last entity of the entity selection as it would be sorted in ascending order using the entitySelection.orderBy( ) method.
If you pass in attributePath a path to an object attribute containing different types of values, the entitySelection.max( ) method will return the maximum value within the first scalar type in the default 4D type list order (see collection.sort( ) description).
entitySelection.max( ) returns undefined if the entity selection is empty or attributePath is not found in the object attribute.
An error is returned if:
We want to find the highest salary among all the female employees:
C_OBJECT($sel)
C_REAL($maxSalary)
$sel:=ds.Employee.query("gender = :1";"female")
$maxSalary:=$sel.max("salary")
Product: 4D
Theme: ORDA - EntitySelection
Created: 4D v17
Modified: 4D v18 R6
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)