Using the rule editor

The rule editor helps you to write the rules by providing an automatic completion mechanism to select the constructs and statements that make up the rule.

When you create or open a rule, the editor opens by default.

You can add terms and phrases to a rule by typing or pasting in text, or by selecting them from the completion menu. If you select a phrase that contains placeholders, you must replace each placeholder with a term, value, or other phrase.

Terms and phrases

The rule editor provides an editing area for building rules. You can add terms and phrases in the following ways:

  • Type directly in the editing area.

  • Copy text from another editor or application, and paste it into the editing area.

  • Select predefined terms and phrases from a completion menu.

Completion menu

The data model defines the terms and phrases in the completion menu, and the ways you can combine them.

Placeholders

Placeholders indicate places in a term or phrase that you must complete. You must insert the name of a business term, a value, or some other phrase in order to construct a valid expression. Placeholders are identified with angle brackets. For example, the following phrase contains the placeholder <a customer>:

the age of <a customer>

To complete this phrase, click the placeholder. You can then either start typing a value or business term, or select a term or phrase from the completion menu. Completion menu options might contain more placeholders that you must also complete to construct a valid expression.

Comments

You can add comments to help you structure and document your rules.

One line comments and inline comments both use double dashes (--). The comment finishes at the end of the line. For example:
if
   insurance is null -- Condition to set a default value
then
-- Insurance rate as of 01/01/2017 is 0.02
   set insurance to insurance.of ( 0.02 , true ) ;