2.64.7.4 Other Function: Aggregate
The following are the arguments, types, and specification of the Aggregate function.
Function |
Arguments |
Type |
Specification |
---|---|---|---|
Aggregate |
Return |
* |
Return type is the same as Expression. |
Expression |
The aggregate expression to evaluate. |
The Aggregate function is used for controlling the entity context in which an aggregation is evaluated.
For example, consider an attribute named "TotalSales"
defined on an entity named "Order". The expression to show the total
sales within the context of an order would be TotalSales. The expression to
calculate the total sales within the context of a customer would be:
Aggregate([customer->order]TotalSales)
The Expression argument MUST contain a non-anchored expression or one or more nested passthrough functions that MUST take any data type, where the innermost passthrough argument has a non-anchored node in a semantic query expression tree.
For example:
Aggregate([customer->order]Filter([order->product]Sum(UnitPrice), Equals(Shipped,"True")))