company logo

Aggregation operation

Aggregation operations may apply also directly on a collection. Passing a collection as calling object to an aggregation operation or using an aggregation operation in an access path, All attributes from collection instances become attributes of the aggregation instance. Transient attributes from source instances become non-transient attributes in the result instances.

Aggregation functions applying to attributes depend on source definitions for the attributes. Attributes without source definition are aggregates using the maximum() function for non-numerical attributes and the sum() function for numerical attributes.

The currently selected order key defines the aggregation components and hierarchy. When no order key has been defined, the identifying key of the data type is used, instead. When no key is defined at all, the operation fails.

The result of an aggregation collection is stored as transient collection. In order to make it persistent, one may call the toDatabase() operation.

Thus applying an Aggregate() operation on a view path (...Group(...).SELECT(...).AGGREGATE(...)) produces the same result as defining a corresponding view.