accumulate
Syntax
Shorthand syntax
- accumulate
Extended syntax
- accumulate:
reset: expression
Description
The accumulate operation does not take any parameters by default. Accumulate is intended to take in numeric input. It maintains an internal sum. For each value that gets passed in, the value is added to the sum and the sum is emitted as the output of the operation.
It's important to be aware of how data flows into the operation. Repeat values can flow through an operation chain due to changing inputs causing the operation chains to be recomputed. These repeats will also be counted by the accumulate operation. As such, this operation is best paired with other specific operations such as value-increase-diff or resample.
An optional reset parameter can be supplied to count which takes an expression. Whenever the expression evaluates to true, the computed sum will be reset to 0.
Examples
- AdapterScript
var1:
- source: partcount
- value-increase-diff
- expression: "execution == 'ACTIVE' ? this : 0"
- accumulate
In the above example, partcount
and execution
are identifiers from another part of the adapter script