Punctuation in rules

The business rule language uses punctuation to identify specific language artifacts and to avoid ambiguous syntax. When you edit business rules (for example, in the Intellirule editor), mandatory punctuation is usually predicted in the completion menu.

Backslash \

The backslash is used to prefix special characters in text strings.

Comma ,

The comma marks the end of Where statements.

Example

This example shows a Where statement that is closed by a comma.

if
  there is at least one car
    where
      the color of this car is blue,
then ... 

Some language constructs may be terminated by an optional comma.

Example

This example shows a construct that is terminated by an optional comma. This may prevent the construct becoming ambiguous in a particular context.

all following conditions are true:
  - the color of the car is blue
  - the price of the car is more than 1000,

Double quotation mark "

Double quotation marks are used to enclose string literals; that is, text strings. Avoid using them in the verbalization of BOM classes and members.

Example

This example shows an action phrase in which the message to be displayed is a text string enclosed in double quotation marks.

then
    apply a 10% discount;
    display the message: "You received a discount!";

Parentheses ()

Parentheses can be used to group any expression. They can help clarify the default precedence of logical operators linking conditions to one another. You can also use parentheses to regroup condition statements and hence change the order in which they are interpreted.

Example

This example shows nested parentheses in an action phrase.

then
    print "the customer: " + (the name of the customer of (the shopping cart))

Semicolon ;

The semicolon marks the end of variable definitions and action phrases.

Single quotation mark '

Single quotation marks are used to enclose variables. Single quotation marks are optional for single-word variables and mandatory for variables that consist of several words. Automatic variables are not enclosed in single quotation marks. Because single quotation marks are frequently used in the rule language, avoid using them in the verbalization of BOM classes and members.

Example

In this example, the variables customer and the cart are defined. The customer variable does not need to be enclosed in single quotation marks because it is a single word, whereas the cart needs to be delimited because it consists of two words.

definitions
    set customer to a customer;
    set ‘the cart’ to the shopping cart of customer;