Apama Documentation : Developing Apama Applications : Developing Apama Applications in Event Modeler : Overview of Using Event Modeler : How rules define scenario behavior : Description of rule conditions
Description of rule conditions
The condition specified in a rule must be true for the action part to be executed. Conditions can be as straightforward as the example seen so far, such as a condition that specifies just true (evaluated once). This condition causes the action part to execute whenever the rule is evaluated. However, more often a condition will specify a constraint on the value of a variable, field or parameter, for example, "is a particular variable at present greater than this value". It can also be a complex composition of various conditions defined using the operators and and or. For example:
1. Click on the Wait for Spread state.
2. In the global rules pane, scroll down to the last global rule, the one labeled Volume limit check.
Consider the condition for this first rule. This condition will be true if:
( Quantity 1 + ABS(Current Position 1) ) is greater than or equal to Max
Quantity 1
or
( Quantity 2 + ABS(Current Position 2) ) is greater than or equal to Max
Quantity 2
This condition contains two clauses:
*Whether the result of the variable Quantity 1 being added to the absolute value of Current Position 1 is greater than or equal to the variable Max Quantity 1.
*Whether the result of the variable Quantity 2 being added to the absolute value of Current Position 2 is greater than or equal to the variable Max Quantity 2 .
As the two clauses are joined with an or, only one needs to be true for the condition to be true as a whole. Had the operator used been an and, then both of the clauses would have needed to be true for the condition as a whole to evaluate to true.
A condition needs to evaluate to the value true or false. Apart from the literal values true and false themselves, a condition can also consist of any of the following:
*The inverse of any other condition. This can be achieved by expressing not before that condition
*A variable (or block parameter or block output field) that is of type True/False (or condition)
*A check on whether a variable's value (or block parameter or block output field) has changed since the beginning of this state or since it was last checked by this rule
For example, Max Quantity changes
*A function call whose result is either true or false
For example, isWeekday("Friday")
*Any numeric expression being compared with another numeric expression. A numeric expression equates to a numeric value, and can be arrived at by any combination of arithmetic operations, functions and/or number variables. Numeric expressions can be compared to each other with is less than, is less than or equal to, is greater than, is greater than or equal to, is equal to, and is not equal to.
For example, Price is less than 20
or
((Price * 2) / Quantity) is greater than POW(Upper Limit, 5)
*Any text expression being compared with another text expression. A text expression is a string (that is, a word or phrase) and can be arrived at by any number of operations, functions and/or text variables. Text expressions can be compared to each other with is equal to, is not equal to, and contains.
For example, Name is equal to "Tom"
or
"Bookmark" contains "book"
*Any choice variable being compared with a valid choice value. The latter can be another choice variable or a text expression. A choice variable is one whose valid values are limited to a particular selection of text values. The valid comparisons here are is equal to, and is not equal to.
*Any number of nested conditions joined with and or or
For example, Max Quantity changes and ( Price is less than 15 or Price is greater than or equal to 20 )
Details on how to specify conditions in the Rules panel are given in Working in the Rules panel.
Copyright © 2013-2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product LogoContact Support   |   Community   |   Feedback