155
CLEM Language Reference
Function Result Description
@SUM(FIELD,EX PR) Number
Returns the sum of values for FIELD over the last
EXPRr ecords received by the current node, including
the current record. FIELD must b e then ameo f
a numeric eld. EXPR may be any expression
evaluating to an integer greater than 0. If EXPR
is omitted, or if it exceeds the number of records
received so far, the sum over all of the records
received so far is returned.
@SUM(FIELD,EXPR, INT) Number
Returns the sum of values for FIELD over the
last EXPR records received by the current node,
including the current record. FIELD must be
the name of a numeric eld. EXPR may be any
expression evaluating to an integer greater than 0.
If EXPR is omitted, or if it exceeds the number
of records received so far, the sum over all of the
records received so far isr eturned. INT species the
maximum number of values to look back. This is far
more efcientthan us ing just two arguments.
@THIS(FIELD) Any Returns the value of the eld named FIELD in the
currentre cord. Used only in @SINCE expressions.
Global Functions
The functions @MEAN,@SUM,@MIN,@MAX, and @SDEV work on, at most, all of the records
read up to and including the current one. In some cases, however, it is useful to be able to work
out how values in the current record compare with values seen in the entire data set. Using a
Set Globals node to generate values across the entire data set, you can access these value s in a
CLEM expression using the global functions.
For example,
@GLOBAL_MAX(Age)
returns the highest value of Age in the data set, while the expression
(Value- @GLOBAL_MEAN(Value)) / @GLOBAL_SDEV(Value)
expresses the difference between this record’s Value and the global mean as a number of standard
deviations. You can use global values only after they have been calculated by a Set Glo bals
node. All current global values can be canceled by clicking the Clear Global Values button on the
Globals tab in the stream properties dialog box.
Note: @ functions cannot be called from scri pts.
Function Result Description
@GLOBAL_MAX(FIELD) Number
Returns the maximum value for FIELD over the whole
data set, as previously generated by a Set Globals node.
FIELD must be the name of a numeric eld. If the
corresponding global value has not been set, an error
occurs. Note that this function cannot be called from a
script.