Understanding decision columns
Decision columns are used to identify the actions that are required when particular conditions are, or are not, met. They allow the action to be varied according to the result of the condition. There are up to ten decision columns available in a rule set.
The result of a condition is always either Yes or No, and a different action may be required for each result. The result of a condition is entered as Y or N in the decision columns for the condition. The action required for a result is identified with an X in the same decision column on the appropriate action statement.
For example, a business rule is required to check the value in ledger analysis 5. If it contains the value P01, the rule should set the value of ledger analysis 6 to ABC. If ledger analysis 5 contains any other value, ledger analysis 6 should be set to 123.
In this example, decision column 1 is used to identify the action if the result of the condition is Yes, and decision column 2 is used to identify the action if the result is No.
Command | Value 1 | Operator | Value 2 | Decision Column 1 | Decision Column 2 |
IF | Ledger Analysis 5 | = | P01 | Y | N |
SET | Ledger Analysis 6 | = | ABC | X | |
SET | Ledger Analysis 6 | = | 123 | X |
Using multiple IFs and decision columns
You can include multiple IF condition statements in a rule set to check different data items. If you use the same decision columns on each statement, the results of the IF statements are linked. Alternatively, if you use separate decision columns, the IF statements are treated separately.
An example of multiple, related IF statements
The following rule set displays an error message if a journal description has not been entered when the account code is P01.
This rule does nothing if the account code is not P01, or if the description is not blank, because these results have not been identified in decision columns.
Command | Value 1 | Operator | Value 2 | Decision Column 1 |
IF | Account Code | = | P01 | Y |
IF | Description | = | SPACE | Y |
DISPLAY | Desc-Required_Message | X |
An example of multiple, unrelated IF statements
In this example the first two IF statements are related because decision columns 1 and 2 are used for both statements. The rule checks the contents of both the account type and address code items before deciding on the action required, that is to either display an error message or display address line 1.
The third IF statement is unrelated and is treated separately because it references a different decision column (3). Ledger analysis code 4 is checked and an error message is displayed if it is missing, regardless of the account type and address code values.
Command | Value 1 | Operator | Value 2 | Decision Col 1 | Decision Col 2 | Decision Col 3 |
IF | Account Type | = | Debtor | Y | Y | |
IF | Account Code | = | SPACE | Y | N | |
IF | Ledger Analysis 4 | = | SPACE | Y | ||
DISPLAY | Error Msg - Address Code required | X | ||||
DISPLAY | Address Line 1 | X | ||||
DISPLAY | Error Msg - Analysis Code 4 required | X |
The example above is extended below to illustrate the use of the OR statement. The decision column results are not entered on the OR statements because they are simply the continuation of the preceding IF statement.
Command | Value 1 | Operator | Value 2 | Decision Col 1 | Decision Col 2 | Decision Col 3 |
IF | Account Type | = | Debtor | Y | Y | |
OR | = | Creditor | ||||
OR | = | Client | ||||
IF | Address Code | = | SPACE | Y | N | |
IF | Ledger Analysis 4 | = | SPACE | Y | ||
DISPLAY | Error Msg - Address Code required | X | ||||
DISPLAY | Address Line 1 | X | ||||
DISPLAY | Error Msg - Analysis Code 4 required | X |