Prev Next

Define Rule Conditions

When you create the Business Domain model, you set up a number of Classes that define the business terms and entities (such as Customer) and their associated attributes and operations. You create the attributes and operations as you set up the Class, with at least some values or parameters, and you tailor some of the features to the rules to define the conditions through which a rule takes effect, in the Rule Conditions table.

For example, in a Class that defines the properties of Car, the attribute Type might be used to set the condition 'Car is: Small, Medium or Large', through which the rules defining base rental charge would be filtered and applied.

Access

Context Menu

Open diagram | Right-click on a Rule Task element | Rule Composer > Decision Table

Model Rule Conditions

Step

Action

See also

1

From the appropriate Class element in the Project Browser, drag and drop the condition attribute (such as age) or operation (such as IsValidLicense()) onto the first empty field in the 'Rule Conditions' column.

  • The 'Rule Conditions' fields apply Intelli-sense to display possible entries for the field; press Ctrl+Spacebar in the field to display a list of possible Classes, double-click on the selected Class, type . (a period) and double-click on the attribute or operation in the automatically-displayed list
  • If the 'Rule Condition' is of type enum, the 'Allowable Values' field is automatically set with the enum literals; this procedure then ends here

2

Determine a range of accepted values for the Rule Condition.

3

Right-click on the 'Allowable Values' column and select:

  • For an attribute, the 'Edit Allowable Values' option; the 'Edit Allowable Values' dialog displays
  • For an operation, the 'Edit Parameters' option; the 'Edit Parameters' dialog displays (see step 5)

Type each required value or range of values in the 'Value' field, and click on the Save button to display the value in the 'Allowable Values' list box

age could have the values:

  • <18
  • >18 and <50
  • >50

IsValidLicense() could return:

  • True
  • False

4

Click on the OK button to save the values and close the dialog; for an attribute, a new constraint AllowableValues is created.

  • You can check this constraint by opening the 'Properties' dialog for the attribute and selecting the 'Constraints' tab
  • If the Rule Condition references an enumeration, the enum literals are not editable in the 'Edit Allowable Values' dialog

5

If the Rule Condition is an operation, you can pass parameters to it.

Right-click on the 'Allowable Values' field, and select the 'Edit Parameters' option; the 'Edit Parameters' dialog displays, listing the parameters that already exist for the operation.

Select the parameters and type their values into the 'Value' text box; click on the OK button to cancel the dialog.

  • You can add an operation as a Rule Condition more than once, so you can call the operation with different sets of parameters

6

To add another Rule Condition, right-click on the 'No' column and select the 'Add Row' option; an empty row is added to the table.

To remove a Rule Condition from the table, right-click on the appropriate 'No' field and select the 'Delete Row' option.

  • If the condition is based on an attribute, this does not affect either the original attribute or the new constraint in the model; you can either re-use the attribute with its constraint, or use the attribute 'Properties' dialog to remove the constraint

7

If any of the condition values invoke an action or a decision, you can define it as a Rule Action.

Define Rule Actions

Learn more