skip to main content
Corticon Studio: Rule Modeling Guide : Rule writing techniques and logical equivalents : Embedding attributes in posted rule statements
 

Try Corticon Now

Embedding attributes in posted rule statements

It is frequently useful to embed attribute values within a Rule Statement, so that posted messages contain actual data. Special syntax must be used to differentiate the static text of the rule statement from the dynamic value of the attribute. As shown in Sample Rulesheet with Rule Statements Containing Embedded Attributes, an embedded attribute must be enclosed by curly brackets {..} to distinguish it from the static Rule Statement text.
It may also be helpful to indicate which parts of the posted message are dynamic, so a user seeing a message knows which part is based on live data and which part is the standard rule statement. As shown in Sample Rulesheet with Rule Statements Containing Embedded Attributes, square brackets are used immediately outside the curly brackets so that the dynamic values inserted into the message at rule execution will be bracketed. The use of these square brackets is optional – other characters may be used to achieve the intended visual distinction.
Remember, Action Rows execute in numbered order (from top to bottom in the Actions pane), so a Rule Statement that contains an embedded attribute value must not be posted before the attribute has a value. Doing so will result in a null value inserted in the posted message.
Figure 93. Sample Rulesheet with Rule Statements Containing Embedded Attributes
Figure 94. Rule Messages Window Showing Bracketed Embedded Attributes (Orange Box)
When an attribute uses an Enumerated Custom Data Type, the dynamic value embedded in the posted Rule Message will be the Value, not the Label. See the Rule Modeling Guide, Building the Vocabulary chapter for more information about Custom Data Types.

No expressions in Rule Statements

A reminder about the table Vocabulary usage restrictions in Rulesheet sections, which specifies that the only parts of the Vocabulary that may be embedded in Rule Statements are attributes and functions (today and now). No operators or expressions are permitted inside Rule Statements. Often, operators will cause error messages when you try to save a Rule Set. Sometimes the Rule Statement itself will turn red. Sometimes an embedded equation will even execute as you intended. But sometimes no obvious error will occur, but the rule does not executed as intended. Just remember that operators and expressions are not supported in Rule Statements.