OCLOperators groupBy

Builds a collection of tuples grouped by some aspect. OCL groupBy expression groups together a collection of all matching objects based a specified criteria returning a tuple of the grouping criteria object and Collection of the matching objects in the List property.

groupBy is well suited for aggregation with its ability to utilize tuples enabling the creation of aggregate expressions for extraction of patterns from model-driven data that can be used for statistical analysis..

Example

How to use ocl group by expression

To get the product sales made on specific dates

Ocl groupby operator

To get product sales made on specific dates with the quantity and and sales amount.

groupby aggregation expression

Tuple Parts Description
Part1 The grouping criteria object accessed as object type .DateAdded instead of .Part1 since it is known in the tuple
Part2 The total quantity sold accessed as .Part2 since it is not known in the tuple
Part3 The total sales amount accessed as .Part3 since it is not known in the tuple
This page was edited 82 days ago on 06/30/2024. What links here