company logo

group by method

The group by method is a method, which allows creating aggregates for instances in a collection passed to the operation. After grouping a collection of instances will be provided, where each instance has a "value", which is the identifying key of the instance and a collection property "partition", which collects all the instances from the source, that correspond to the grouping value of the instance.

Grouping instances is possible in different ways. Grouping by property groups all instances having the same property value in one partition, i.e. the function creates as many partitions as there are values defined for the grouping property. The property value of the grouping property becomes the identifying key of the grouping instances.

Grouping by categories allows defining ad-hoc categories like income groups or age groups. Ad-hoc categories are defined by value: condition, where the value defines the grouping value and the condition defines the condition, which must be true for assigning a source instance to the category of the given value.

Generalisations:  OQL method

Related topics