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.