Using the event rule feature, you can associate business rules and policies with the definition of a table. These rules are run whenever data in the table is manipulated. You can code two types of event rules:
A trigger rule causes additional processing to take place when a table is accessed. For example, it can be used to create an audit trail, or maintain a one-to-one relationship between two tables.
These rules run based on defined accesses. All the rules that apply to a specific access are executed in the order in which they are entered in the event rule section.
Trigger rules can be nested up to a maximum depth of five accesses. For example, an access to one table can trigger access to another table, which in turn can trigger access to another table, and so on. The following restrictions apply to the coding of a trigger rule:
The search path for the application invoking the event rule determines the search path for the event rule. Because the Table Editor on the developer’s workbench has a search path of S (system library), when you are accessing the table from the workbench you must execute the shareable tools
STEBROWSE or
STE to browse or edit a table using an event rule. For more information about these tools, refer to
TIBCO Object Service Broker Shareable Tools.
The sample table has two event rules defined, DELETEMPNO and VALIDEMPNO. The following illustrations show the coding of these rules.
The second rule, VALIDEMPNO, determines if an employee number entered in as data to the table is below an accepted numeric limit. It returns a message to the screen if the supplied value is invalid.
An event rule running on a local node can access data on a remote node. An event rule running on a remote node as the result of a remote data access can only access data on the same node. The following illustration shows the valid and invalid accesses.