Skip to main content
Version: 7.0

Extremum (MAX, MIN)

The extremum operator creates a property which calculates the maximum or minimum among several specified properties. At least one property must be specified. If the value of any of these properties is NULL, this property is ignored. If the values of all properties are NULL, the result value is also NULL.

The operands must belong to compatible classes — built-in classes of the same family, or user classes related by inheritance.

Determining the result class

The result class is the common ancestor — built-in or user-defined — of the operand classes.

Language

The maximum property is created using the MAX operator, the minimum - using the MIN operator.

Examples

date1 = DATA DATE(INTEGER);
date2 = DATA DATE(INTEGER);
maxDate (INTEGER i) = MAX date1(i), date2(i);

balance = DATA INTEGER (Item);
outcome 'Balance (non-negative)' (Item i) = MAX balance(i), 0;
minPrice(Book b) = MIN price1(b), price2(b);

date (INTEGER i) = DATA DATE (INTEGER);
minDate (INTEGER i) = MIN date(i), 2001_01_01;