calculateIntermediate function (optional)
calculateIntermediate is an optional function
in the list of arguments that are included in the formulas.defineFormula method.
This function is used with calculate and performs more
mathematical operations within the formula definition while the calculate function
satisfies the data buffering requirements of the window definition.
The calculateIntermediate function includes a list
that forms the logic of the formula definition, and can contain any
conditional processing nests, variables, counters, attributes, or
methods. The results of the formula definition are returned with the return method.
calculateIntermediate function
is shown in the following examples:calculateIntermediate:
function( )
{
return (this.input_1.method operation this.input_2.method);
},
calculateIntermediate:
function( )
{
return (this.input_1.inputs.method operation this.input_2.inputs.method);
Where the statements use the following syntax:
| Syntax element | Definition |
|---|---|
function
( ) |
ECMAScript function call used to create and initialize a new function object. The function statement can take an argument heartbeat as an additional input to the formula. For period-based window definitions, the timestamp of the end of the period is input to the formula. |
return (
) |
ECMAScript method that causes a function to cease execution and return a value to the caller. |
this |
Creates an instance of the FormulaOperator object. For more information, see CME formula API object model. |
input_1 |
Specifies the variable
name for a metric or property that is defined within the arguments identifier.
This item can also include other functions or methods that are defined
within the formula. |
inputs |
An optional statement that creates an array of Input objects. For more information, see CME formula API object model. |
method |
Specifies a FormulaOperator or Input method.
For more information, see CME formula API object model. |
operation |
Defines the mathematical operation to be performed on the formula inputs. |
input_2 |
Specifies a variable
name for a metric or property that is defined within the arguments identifier.
This item can also include or call other functions or methods that
are defined within the formula. |
For examples of how the calculateIntremediate function
is used, see Using CME formula API files.