Mashups in Presto Wires : Creating Mashups in Wires : Add Actions or Other Blocks : Aggregate Statistics
Aggregate Statistics
Use the Aggregate block to perform simple calculations on groups of repeating items. Each group is based on the unique values of one field. Optionally, you can filter items for a group or calculate simple statistics for the group. You can define multiple levels of groups.
Note:  
This block is very similar to the Group block. The primary difference is that Group includes data for all the repeating items within its groups. Aggregate only output the unique values for each group and the statistics defined for that group.
1. Connect a document-type result as input to the Aggregate block.
2. Use the Path Selector in Select Repeating Element to identify the repeating items to be grouped.
See Select Fields or Paths for Block Properties with the Path Selector for more information.
3. Define the group in Group Aggregate:
a. Use the Path Selector in Group By Key to find the field within these repeating items to define the group for this level. Each unique value in this field will define one group.
b. Optionally, enter a name for the node that should wrap the statistics for this group in Group Name.
Note:  
Names must be valid XML names, starting with a letter and containing only letters, numbers, underscores (_), dashes (-) or periods (.).
If you omit this property, the root node wrapping all groups defaults to output. For lower level groups, omitting this property omits the wrapping node.
c. If needed, Set Conditions to Filter Items to Include in Groups.
4. Then complete the equation for at least one aggregate statistic:
a. In the left field, enter a name for the result node to contain this calculation.
Note:  
Names must be valid XML names, starting with a letter and containing only letters, numbers, underscores (_), dashes (-) or periods (.).
b. Choose the function for this calculation:
*count
*sum
*avg
*min
*max
c. Use the Path Selector to find the field within these repeating items to use for this calculation. See Select Fields or Paths for Block Properties with the Path Selector for more information.
Note:  
Except for the count function, this field must have numeric data.
5. If needed, click Add an Aggregate to add more calculations for this group.
6. If you need statistics for additional levels of grouping, click Add Nested Aggregate.
This opens a new Group Aggregate section. Complete this section as needed (see previous step) and continue adding Group Aggregate sections to add additional groups as needed.
See Aggregate Configuration Example for an example of group configuration and the output.
Set Conditions to Filter Items to Include in Groups
To filter which repeating items are included in a group, you add a "having" clause..
1. Click Add Having Clause for the group you want to filter. This adds fields defining the filter condition to use to include items in the group.
2. In the left field, use the Path Selector to find the field to compare for this filter. See Select Fields or Paths for Block Properties with the Path Selector for more information.
3. Choose the comparison operator.
Use the basic math operators ( =, <, <=, >, >=) for numeric fields. Use Matches, Does Not Match, Contains or Does NotContain operator for partial matches in text fields.
4. Enter a value to compare this field to or use the Path Selector to find the field for this comparison. See Select Fields or Paths for Block Properties with the Path Selector for more information.
Note:  
Presto developers who know XPath well can use the Advanced Mode button to customize the XPath expressions for conditions. Use the advance mode with care, however, as it disables the display of conditions in basic mode. If you return the condition to basic mode, your customized XPath expression for the condition is lost.
Aggregate Configuration Example
Copyright © 2013-2015 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback