The entitySelection.min( ) method returns the lowest (or minimum) value among all the values of attributePath in the entity selection. It actually returns the first entity of the entity selection as it would be sorted in ascending order using the entitySelection.orderBy( ) method (excluding null values).
If you pass in attributePath a path to an object attribute containing different types of values, the entitySelection.min( ) method will return the minimum value within the first scalar value type in the type list order (see collection.sort( ) description).
entitySelection.min( ) returns undefined if the entity selection is empty or attributePath is not found in the object attribute.
An error is returned if:
- attributePath is a related attribute,
- attributePath designates an attribute that does not exist in the entity selection dataclass.
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")