computeFunction element

The <computeFunction> element is valid only for the computation rule. It contains an expression that is called as each event is received and that returns a value to be stored in a variable that is defined for the rule. The value that is returned from this expression must match the data type of the variable that is named in the assignTo attribute of the <computeFunction> element.

Details

Refer to Variables for information about the variables that can be used in expressions. The use of certain variables is dependent on the context of the expression.

Attributes

<computeFunction> has the following attributes:

Table 1. Attributes of the <computeFunction> element
Name Description Data type Required?
expressionLanguage Identifies the programming language in which the expression is written. Because the Java™ programming language is the only supported expression language, the only valid value for this attribute is java. xsd:NMTOKEN Yes
assignTo Identifies the name of the variable that holds the value that is returned from this expression. This variable must already be defined for the rule (at the rule set, rule block, or rule level) using the <variable> element. If the variable is defined at the rule set or rule block level, it is not reinitialized after the rule pattern is matched. xsd:NMTOKEN Yes

Contained within

<computeFunction> is contained within the following element:

Contains

<computeFunction> contains no elements.

Related concepts
Expressions