Business Rules
A business rule is a statement that defines, or constrains, some aspect or operation of the business. It is intended to control or influence the behavior of the business operations. Business rules are logical integrity rules, and differ from database oriented referential integrity rules.
Business Rules - example
Business rules in a purchasing system could be as follows:
- An item can be ordered only from its supplier
- When the gross weight and net weight for an item are the same, there is no packaging
- The supplier provides the arrival date of a purchase order after the order is entered into the system.
- Items cannot be removed if there is stock on-hand
- The item on-order quantity is increased when an order for the item is entered
- The item on-hand quantity is increased, and the on-order quantity decreased, when an order arrives
Referential Integrity Rules - example
In contrast, integrity rules in a purchasing system could be as follows:
- An item must exist for it to be ordered
- If an item has a supplier, the system must know the supplier
- Items can not be deleted if the item record is used elsewhere in the system
Business rules are implemented as hooks. A hook is a pre-defined function name you create in a Data Access Layer script. The 4GL engine will call this function as it executes user interface and database related actions on the table the DAL is written for.
Business rules fall into categories that determine how the business rule is implemented in the DAL.
The categories, depending on the type of DAL script, are as follows:
- Property or Field hooks
- Object Hooks
- Field Dependencies
- Business Methods