The COLLECTION_MAX function searches an object collection for the object instance whose designated property contains the largest value of all members of the collection and then returns that maximum value. The function takes parameters for the object collection to be searched, the property within the object type of the collection whose value is to be compared between object instances, and optionally a rule term containing the criteria specifying which objects to search and which to exclude.
The optional Boolean parameter to the function is evaluated once for each object instance contained in the specified collection. This term is evaluated in the context of each object instance. The function will then compare only those objects for which this rule term returns true, with those for which it returns false being excluded from the comparison.
The data type of the property to be compared should be one for which a value comparison makes sense. While a minimum or maximum value is readily apparent in a primitive data type such as an integer, such a comparison makes little sense for a signature or external data property type. For property data types like the latter, the return value is undefined. The data type of the property to be compared in each function should be considered in relation to the data type of the function’s context. Though the function supports the integral number, decimal number, and string return types, the conversion from the property’s data type to the return type should be “type safe.” Specifically, if the designated property to compare in each object is a string, the function should not be called in an integral or decimal number context.
(Object Collection, Child Property [, Include Criteria])
- Object Collection Required object collection property parameter; specifies the collection to be processed by the function.
- Child Property Required property parameter; specifies the property whose value will be compared in each object instance in Object Collection. The data type of this property specifies the type of comparison made between the values for each object instance.
- Include Criteria Optional Boolean parameter; this term is evaluated once for, and in the context of each object instance in Object Collection. The function will compare the Child Property value of each object instance for which Include Criteria returns true, and excludes from this processing each object for which false is returned. If this parameter is omitted, all object instances in the collection will be processed.
Supported Return Types
- Integral Number
- Decimal Number