Developing Apama Applications > Developing Apama Applications in Event Modeler > Using Standard Blocks > Blocks for working with scenario blocks > Filtered Summary v2.0
Filtered Summary v2.0
The Filtered Summary block performs simple calculations across a set of sub-scenarios. This is an alternative to iterating over a set of sub-scenarios. The Filtered Summary block can operate on only floating point values.
Description
In more general terms, the Filtered Summary block performs calculations on a keyed set of floating point values. Typically, you use the sub-scenario instance ID as the key. The key’s associated value is the value of a sub-scenario floating point variable that you want to use in an aggregate calculation.
You can specify filters to perform calculations on a sub-group of sub-scenarios. You can also remove keys and their associated values from the Filtered Summary block’s internal data store. This lets you exclude data from certain sub-scenarios from the calculations. One way to do this is to define a global rule that watches for sub-scenarios to terminate. When a sub-scenario terminates, you can specify its instance ID as the key and remove the data for that key from the Filtered Summary block’s store of data.
To use the Filtered Summary block, wire output fields from the scenario block to input fields of the Filtered Summary block. Typically, you want to map the scenario block instance id output field to the Filtered Summary key input field. Then map a floating point sub-scenario variable from the scenario block output feed to the Filtered Summary value input field.
Parameters
Parameter
Description
filter
String that indicates that you want to perform calculations on only those key/value pairs for which the input filter field matches this field. An empty string as the value of either the filter parameter or the input filter field indicates that there is no filtering. If the value of the filter is "not equal to" parameter is true, and you specify a value for the filter parameter, the Filtered Summary block operates on key/value pairs for which the input filter field does NOT match the value of the filter parameter.
keyToDelete
String that indicates a key for which you want to delete data from the Filtered Summary block’s internal store of data. Invoke the deleteKey operation to delete the data associated with this key.
filter is "not equal to"
Boolean that indicates whether you want to match or not match the value of the filter parameter. When the filter is "not equal to" parameter is true, the Filtered Summary block operates on key/value pairs for which the input filter field does NOT match the value of the filter parameter.
Operations
Operation
Description
reset
The Filtered Summary block stores data about the number of unique keys it has observed and their most recent associated values. This operation flushes that data; it is no longer accessible to the Filtered Summary block.
deleteKey
Deletes the key defined by the keyToDelete parameter. This operation deletes data from the Filtered Summary block’s internal store of data. If the value of the keyToDelete parameter is an empty string, this operation does nothing.
Input feed
The input input feed provides the key, the value, and possibly a filter.
Feed
Fields
Description
input
key
String that contains the key under which you want the Filtered Summary block to store data in its internal data store. Typically, the key is the instance ID of a sub-scenario. The Filtered Summary block ignores blank keys, that is, a key that is an empty string
value
A float value that you want to operate on. Typically, this is the value of a sub-scenario variable.
filter
String that contains a filter for determining the key/value pairs you are interested in.
Output feed
The data output feed indicates the number of keys for which data is stored, the sum of the stored values, and the average of the stored values.
Feed
Fields
Description
data
numberOfKeys
Integer that specifies the number of unique keys for which the Filtered Summary block currently stores data.
totalValue
Floating point value that is the sum of the values that the Filtered Summary block currently stores.
averageValue
Floating point value that is the average of the values that the Filtered Summary block currently stores.
Copyright © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.