Using multiple IFs and decision columns
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 |