How action rules work
You express business policies in rules that match actions to conditions.
An action rule defines the specific actions to take when certain
conditions are met. A basic action rule uses an if-then statement
to associate a condition (if) with an action (then).
The rule states what action to do when a condition is true, for
example:
if the credit score of ‘the borrower’ is less than 200 then in 'the loan report', reject the loan with the message "Credit score too low.";
You write an action rule as a sentence in a natural language. The
rule is composed of business terms, operators, and values. In the
example, the credit score of the
borrower is a business term, is
less than is an arithmetic operator, and 200 is
a value.
Business applications call the rules to execute them, and provide
data values for the business terms. In the example, the action rule
must access data for the business terms the credit score of the borrower and the loan report.
To provide a complete statement, an action rule can consist of four parts: definitions, if, then, and else.
The following example shows the four parts in a rule:
definitions set applicant to a customer where the category of this customer is Gold if the value of the applicant's shopping cart is more than $100 then apply a 15% discount else apply a 5% discount
- Definitions (
definitions) - Use the
definitionspart to define variables for the rule.The
definitionspart is optional.
- Conditions (
if) - Use the
ifpart to specify the conditions for doing the actions in thethenandelseparts. In the example, the condition isthe value of the applicant's shopping cart is more than $100.The
ifpart is optional. Rules without conditions do their actions under all circumstances.
- Actions (
then) - Use the
thenpart to define one or more actions to do if theifpart is true. The action in the example says toapply a 15% discountif theifpart is true.The
thenpart is mandatory. The rule must have at least one action.
- Alternative actions (
else) - Use the
elsepart to define one or more actions to do if theifpart is false. Theelsepart of the example says toapply a 5% discountif theifpart is false.The
elsepart is optional. If theifpart of a rule is false, and there is noelsepart, the rule does not execute an action.