sum()

Adds the values of the specified attribute for all business objects in this business object array.

Syntax

double sum(String attrName)
 

Parameters

attr
A variable that refers to an attribute in the business object. The attribute must be of type int, float, or double.

Returns

The sum of the specified attribute from the list of the business objects.

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 sum() method can set the following exception type for these exceptions: AttributeException.

Examples

double sumSalary = items.sum("Salary");
 

Copyright IBM Corp. 2003, 2004