Business rule parts and structure in the Process Designer

Business rules, such as action rules or decision tables, express business policy statements using a predefined business vocabulary that can be interpreted by a computer. Rules authored in the Business Action Language (BAL) are also easily readable by humans.
For example, the business policy "refuse a loan to customers whose credit score is below the minimum of 200" can be expressed as a business rule in the following way:
definitions
set minimum_score to 200;
if
the credit score of the borrower is less than minimum_score
then
refuse the loan with the message "Credit score below" + minimum_score;
The parts must be defined in the following order:
  1. definitions part
  2. if (conditions) part
  3. then (actions) part
  4. else (optional actions) part

Definitions

The definitions part of a rule gives you more control over your business rules when you set variables at the beginning of your rule. Variables help you identify and then reference an occurrence of a business term by a convenient name. Use variables to make your business rules less ambiguous and easier to understand.

Define a variable by giving it a name of your choice and then setting a value for the variable. This value can be a number (or an arithmetic expression whose result is a number), text, or a predefined business term that already exists in your rule (for example, customer). Once you have set a variable, it becomes available in all the parts of the current rule. The variable is valid only in the rule in which it is defined.

The simplest use of definitions is to define a constant value that you can use throughout your rule. For example, by declaring a variable called minimum_score in the example rule, you make the rule easier to understand:
definitions
set minimum_score to 200;

This is a very basic illustration of the definitions part of a rule. For more information about complex versions of the definition part, such as multiple occurrences of a value, or adding a where clause to a definition to apply further restrictions on the variables, refer to the related section in the IBM® Operational Decision Manager knowledge center, "BAL constructs -- definitions." A related link is provided.

Conditions

The condition part of a rule specifies under what conditions the actions in the action part of the rule will be carried out. Conditions are represented in the rule editor by the text (or number) that appears after if, ending at then. The word then signals the beginning of the action part of the rule.
In the example rule, the condition is defined so that when the credit score of the borrower is below the minimum value, then the loan to the customer is refused.
if
the credit score of the borrower is less than minimum_score
This is a simple condition that is either true or false. The action is carried out if this condition is true. The condition part of a rule can be made up of one or more condition statements. For more information about conditions, refer to the section "BAL constructs" in the IBM Operational Decision Manager knowledge center.

Actions

The action part of a rule describes what to do when the conditions of the rule are met. Actions are represented in the rule editor by the text that appears after then and else. If there is more than one action to perform, the actions are carried out in the order that they appear in the action part of the rule.
In the example rule, the action is defined so that when the condition evaluates to true, then the resulting action is to refuse the loan, and issue a message "Credit score below 200."
then
refuse the loan with the message "Credit score below" + minimum_score;
Optionally, you can include an else part in a rule. The else part of a rule is an optional block of actions that specify what to do when the conditions are not met. You can use an else rule part in combination with variables in the definitions part to control the rule action more precisely. If a rule contains both definitions and a condition part, the else part of a rule will only be run if the conditions set in the variables are satisfied and the condition part of the rule is not satisfied. This sample rule shows this application for the else part:
definitions
set applicant to a customer
      where the category of this customer is Gold;
if
the value of the shopping cart of the applicant is more than $100
then
apply a 15% discount
else
apply a 5% discount;
This rule applies an extra discount only for customers who qualify for the Gold category. For more information about actions, refer to the section "BAL constructs" in the IBM Operational Decision Manager knowledge center.
Important: When a rule changes a list that is referenced by, or is part of, some variable (by adding, removing, or changing list elements), and this variable does not appear as the first argument of a set statement, to ensure that modifications to the elements of this list are visible after the rule is executed, you must add a dummy assignment, for example:
set applicant_list to applicant_list;