OCLOperators groupBy
(Replacing message template with parser tag)
No edit summary
Line 2: Line 2:
Builds a collection of tuples grouped by some aspect.
Builds a collection of tuples grouped by some aspect.
[[Category:OCL Collection Operators]]
[[Category:OCL Collection Operators]]
{{Edited|July|12|2024}}
{{Edited|July|12|2024}}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 <code>List</code> 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
 
[[File:how-to-use-groupby-ocl-operator.png|alt=How to use ocl group by expression|frameless]]
 
To get the product sales made on specific dates
 
[[File:ocl-groupby-expression.png|alt=Ocl groupby operator|frameless|791x791px]]
 
To get product sales made on specific dates with the quantity and and sales amount.
 
[[File:groupby-aggregation-expression.png|alt=groupby aggregation expression|frameless|854x854px]]
{| class="wikitable"
|+
!Tuple Parts
!Description
|-
|Part1
|The grouping criteria object accessed as object type <code>.DateAdded</code> instead of <code>.Part1</code> since it is known in the tuple
|-
|Part2
|The total quantity sold accessed as <code>.Part2</code> since it is not known in the tuple
|-
|Part3
|The total sales amount accessed as <code>.Part3</code> since it is not known in the tuple
|}

Revision as of 01:02, 20 June 2024

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