Integration Server 11.1 | Built-In Services Reference Guide | Streaming Folder | Summary of Elements in this Folder | pub.streamProcessing:combineCalculations
 
pub.streamProcessing:combineCalculations
WmStreaming. Combines calculations made for an event trigger that uses a CALCULATE step as part of window processing. Use this service to combine the calculations from the current window with running calculations from earlier windows.
Input Parameters
fromCalculations
Document A document (IData object) containing the values to combine with toCalculations.
Key
Description
count
String Optional. Number of entries in the result set for the window. The supplied value must be a number that is represented as a String.
max
String Optional. Maximum value for the parameter in the window to which the CALCULATE step was applied. The supplied value must be a number that is represented as a String.
min
String Optional. Minimum value for the parameter in the window to which the CALCULATE step was applied. The supplied value must be a number that is represented as a String.
sum
String Optional. Sum of the values for the parameter in the window to which the CALCULATE step was applied. The supplied value must be a number that is represented as a String.
first
Object Optional. The first value for the parameter in the window to which the CALCULATE step was applied.
last
Object Optional. The last value for the parameter in the window to which the CALCULATE step was applied.
toCalculations
Document. A document (IData object) containing the calculations to combine with fromCalculations.
Key
Description
count
String Optional. Number of entries in the result set for the window. The supplied value must be a number that is represented as a String.
max
String Optional. Maximum value for the parameter in the window to which the CALCULATE step was applied. The supplied value must be a number that is represented as a String.
min
String Optional. Minimum value for the parameter in the window to which the CALCULATE step was applied. The supplied value must be a number that is represented as a String.
sum
String Optional. Sum of the values for the parameter in the window to which the CALCULATE step was applied. The supplied value must be a number that is represented as a String.
first
Object Optional. The first value for the parameter in the window to which the CALCULATE step was applied.
last
Object Optional. The last value for the parameter in the window to which the CALCULATE step was applied.
Output Parameters
toCalculations
Document. The toCalculations document (IData object) combined with the values in fromCalculations.
Key
Description
count
String Conditional. Combined count from the calculations. Sum of the input toCalculations/count and the input fromCalculations/count.
This value is returned only if count was included in fromCalculations and/or toCalculations.
max
String Conditional. Maximum value in the combined result calculations for the parameter to which the CALCULATE step was applied.
This value is returned only if max was included in fromCalculations and/or toCalculations.
min
String Conditional. Minimum value in the combined result calculations for the parameter to which the CALCULATE step was applied.
This value is returned only if min was included in fromCalculations and/or toCalculations.
sum
String Conditional. Sum of the sum values in the combined results sets for the parameter to which the CALCULATE step was applied.
This value is returned only if count was include in fromCalculations and/or toCalculations.
first
Object Conditional. The first value in the combined results for the parameter to which the CALCULATE step was applied.
This value is returned only if first was included in fromCalculations and/or toCalculations.
last
Object Conditional. The last value in the combined results for the parameter to which the CALCULATE step was applied.
This value is returned only if last was included in fromCalculations and/or toCalculations.
Usage Notes
The CALCULATE step in event processing applies to a specific parameter. The pub.streamProcessing:combineCalculations service combines calculations performed on the same parameter in multiple windows. The service could combine two windows or add the current window with running calculations.
For example, if the fromCalculations specifies:
count=10
max=5
sum=30
And toCalculations specifies:
count=10
max=3
sum=20
The result of pub.streamProcessing:combineCalculations has toCalculations with:
count=20
max=5
sum=50
If you next execute pub.streamProcessing:combineCalculations to combine the running toCalculations with the following fromCalculations from the current window:
count=5
max=6
sum=10
The resulting running calculations are:
count=25
max=6
sum=60
A common use case for the pub.streamProcessing:combineCalculations service is to maintain running calculations that span multiple windows. For example, if you had an event trigger that produced calculations for each minute of the day, you could use this service to cache the results for the entire day.
This can be done in the event trigger target service using the following steps:
1. Fetch the running calculations from the cache.
2. Combine the current window's calculations with the running calculations using the pub.streamProcessing:combineCalculations service.
3. Write the new calculations back to the cache.