max()

Retrieve the maximum value for the specified attribute among all elements in this business object array.

Syntax

String max(String attr)
 

Parameters

attr
A variable that refers to an attribute in the business object. The attribute must be one of these types: String, LongText, int, float, and double.

Returns

The maximum value of the specified attribute in the form of a string, or null if the value for that attribute is null for all elements in this BusObjArray.

Exceptions

UnknownAttributeException--When the specified attribute is not a valid attribute in the business objects passed in.

UnsupportedAttributeTypeException--When the type of the specified attribute is not one of the supported attribute types listed in the note section.

All of the above exceptions are subclassed from CollaborationException. The max() method can set the following exception type for these exceptions: AttributeException.

Notes

The max() method looks for the maximum value for the specified attribute among the business objects in this BusObjArray. For example, if three employee objects are used, and the attribute is "Salary" which is of type "Float," it will return the string representing the largest salary.

If the value of the specified attribute for an element in BusObjArray is null, then that element is ignored. If the value of the specified attribute is null for all elements, then null is returned.

When the attribute type is of type String, max() returns the attribute value that is the longest string lexically.

Examples

String maxSalary = items.max("Salary");
 

Copyright IBM Corp. 2003, 2004