Rule sets
A rule set contains a series of conditions and actions that you want to apply to the data entered for a SunSystems function. A rule set is defined for an event profile.
It is the event profile that identifies the SunSystems function for the rule.
A rule set can be used for a variety of purposes; for example to validate data, set data values, perform conversions and calculations on selected data, and establish conditions that control certain processes and actions.
A rule set consists of a series of condition statements followed by a series of action statements, or may just contain a series of actions if they are required under all conditions. It can contain up to 50 condition statements and up to 50 action statements. Condition statements always start with the command 'IF' or 'OR', and the action statements are always defined after the condition statements.
A rule set is defined as a decision table. Decision columns are used to associate one or more actions with the result of one or more condition statements. A rule set contains up to ten decision columns.
An example rule set might look something like this:
Command | Value 1 | Operator | Value 2 | Decision Column 1 | Decision Column 2 | Decision Column 3 |
IF | Product Code | = | P01 | Y | N | |
IF | Cost Centre Code | = | SPACE | Y | ||
SET | Ledger Analysis 6 | = | ABC | X | ||
SET | Ledger Analysis 6 | = | 123 | X | ||
DISPLAY | Missing_CC_Error_Msg | X |
The IF statements are the condition statements, and the SET and DISPLAY statements are the action statements.
The result of a condition statement, either Y(es) or N(o), is indicated in a decision column. The action to be performed for a particular result is indicated by an X in the appropriate decision column on the action statement.
For example, using the rule set illustrated above, if the product code is P01, the value of ledger analysis code 6 is set to ABC as indicated in decision column 1. If the product code is not P01, the value of ledger analysis code 6 is set to 123 as indicated in decision column 2.
Key Points about Rule Sets
- Rule sets contain IF and OR condition statements and action statements, for example SET, DISPLAY, CALCULATE.
- You can have multiple IF and OR statements.
- Action statements are always defined after the condition statements.
- The result of a condition statement is either Y or N and is referenced in a decision column.
- The action for a condition statement/result is indicated by an X in the decision column for the appropriate condition/result.
- The values referenced on a statement can be data items, literal values, workspace areas, or keywords (for example, EXISTS).
- There are ten decision columns per rule set.