| Summary: | Aggregate Functions | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Konstantin Komissarchik <konstantin> |
| Component: | Sapphire | Assignee: | Konstantin Komissarchik <konstantin> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | shenxue.zhou |
| Version: | unspecified | Keywords: | plan |
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
Implemented. Unit tests in TestExpr0010 - TestExpr0013. Verified the fix with purchase order sample. Locally changed the functions on the Subtotal property to verify the Avg, Min, and Max. |
Collections come up frequently in Sapphire EL use cases. When dealing with collections, it is often necessary to aggregate the contained data. We should implement at least these four most common aggregate functions: Sum, Avg, Min, Max The functions should take either one or two arguments. The first argument is always the collection. If the collection is a simple array or a java.util.Collection, the second parameter is not needed. If the collection is a ModelElementList, then the second parameter would be used to specify the name of the list entry's value property to aggregate on (in a form of a string type parameter). If the collection is a ModelElementList and second parameter is omitted, the function should use the first value property found in the list entry type. Example: ${ Sum( Items, "Total" ) } Where Items is a list property containing Item elements that have a value property named Total.