Rule Editing

Modified on 2012/09/22 11:30 by Administrator — Categorized as: Create Rules, Rule Editing

How to Create Terms and Rules

On initial start, the Rule Manager opens any rule policy in restrictive mode. Restrictive mode only allowing you to edit some fields in a rule.

To create new terms and write new rules you have to change the user setting on the rule editor.

Go to menu [File]»[Options]»[Rule Editor] and select the checkbox 'Allow me to create rules and terms'

File Options dialog

Creating a new Policy

If you want to create a new rule policy go to: [File]»[New]»[RuleSet]

File Options dialog

Define a name for your rulebase, ruleset and vocabulary. A rulebase is a collection of rulesets, and is equivalent to a project name in our context.

When you click on 'Create', you will be prompted to save your rulebase to disk. The default file location is the 'My Documents'\'My Rule Policies' folder.

Create a vocabulary

The terms are the building blocks for composing rules and are an essential part of the rule template.

To enable the rule creation feature you have to go to the [File]»[Options] and check the 'Allow me to create rules and terms'

In the Vocabulary View Pane ([View]»[Vocabulary Pane]), right click on the Subject, to show the context menu. The subject is the main entry point that is bound to the rule.

Vocabulary Pane

The context menu let's you create and delete terms. Every term has a defined Name, Type, Description, and Value Range.

The Value Range allows you to define runtime constraint values on terms. e.g. The Fico score must be greater than 0 and must be less than 900 These value range checks are enforced during the runtime execution of the rules engine. When an assigned value exceeds a value range exception will be thrown.

This allows the business user to limits the domain that he has taken into account when writing his rules. E.g. he has no rules defined when a customer has a fico score of 10,000 or a fico score of -20. But if some strange data was passed to the rules engine, we do get an exception to defer from the normal processing flow.

Besides these runtime constraints, you can also define Value Ranges that are in effect during design time of rules. In particular when the rules are maintained by other business users, you can define value restrictions on parameters. You can define these value ranges by right-click on the User Input Fields. This shows the context of creating and deleting 'Input Range' definitions.

Once the terms, value ranges and input ranges are defined they can be dragged-and-drop into the rule condition and action expression.

You can also click Ctrl-Space to shows all the terms available at an expression.

Tip: If you know the term start with 'f', just type 'f' followed by Ctrl-Space and you will see all the terms filtered that starts with the letter f.



Create a new Rule

To create a new rule you can go to [File]»[New]»[Rule] (or Ctrl-N). This will create a blank If Then rule.

File Options dialog

Edit a Rule

Click on the box. Here you can type in literal values, or select a business term by pressing Ctrl+Space. You can also drag-and-drop a term into this expression field.

The expression box reacts to hot keys when it is in Insert-mode. The last expression on every rule line is in this mode. This is visualized by a little arrow in the top-right corner.

Exit the Insert-mode by hitting the 'Esc' key on the expression. Enter the Insert-mode by pressing the key on the expression.

When you press the '=' key the 'is equal to' statement is inserted.

Other commands are
  • & and + New Line
  • | : or + New Line
  • - : - expression
  • + : + expression
  • > : is greater than expression
  • < : is smaller than expression

NOTE: If you want to enter a negative number, say '-10', you have to first press 'Esc' key to get out of the Insert-mode.

Undo Edits

We do not have an undo-commands (Ctrl-Z / Ctrl-Y)

In order to remove an expression:

Right click on the Circle at the start of the line. And click Delete line.



You can reorder expressions by drag-and-drop the Circle's at the beginning of the line.