4 Creating Table Event Rules

This chapter contains the following topics:

This chapter provides an overview of table event rules and discusses how to work with table event rules.

4.1 Understanding Table Event Rules

Use table event rules to attach database triggers (or programs) that automatically run whenever an action occurs against the table. An action against a table is called an event. When you create a database trigger in Oracle's JD Edwards EnterpriseOne, you must first determine which event activates the trigger and then use Event Rules Design to create the database trigger.

Table event rules provide embedded logic at the table level. Table event rules have their own location, events, and system functions. When you use table event rules, neither the calling application nor the user is notified of changes or events to the table. No form or report interconnect is available with table event rules.

You can use table event rules for data integrity. For example, when you delete a record in Oracle's JD Edwards EnterpriseOne Address Book, you might want to delete all associated records, such as phone and category codes. You can also use table event rules for currency. The Currency Conversion is On event rule handles currency information in table event rules.

You can attach event rules on a table-by-table basis to these events:

  • After Record is Deleted

  • After Record is Fetched

  • After Record is Inserted

  • After Record is Updated

  • Before Record is Deleted

  • Before Record is Inserted

  • Before Record is Updated

  • Currency Conversion is On

This table describes the functions that you can use in table event rules:

Functions Description
Assignment\Expression Enables you to create assignments and complex expressions.
If\While Enables you to create IF/WHILE conditional statements.
Business Function Enables you to call existing business functions.
System Function Enables you to attach existing JD Edwards EnterpriseOne system functions.
Variables Enables you to create Event Rule variables.
Else Enables you to insert an ELSE clause, which is only valid within the boundaries of IF and ENDIF.
Table I/O Enables you to create event rules used for database access. Performs table input and output, data validations, and record retrieval.

You do not need to create and associate data structures to table event rule functions. The table itself is the data structure that is passed to the table event rule function.

4.2 Working with Table Event Rules

This section provides an overview of table event rule triggers and discusses how to add table event rules to table conversions.

4.2.1 Understanding Table Event Rule Triggers

To create table event rules, you must:

  • Create the table trigger in Event Rules Design.

  • Generate the JD Edwards EnterpriseOne table trigger as C code.

  • Build the table trigger.

    When you build table triggers, the system performs these actions:

    • Converts the event rule to C source code, which creates the files OBNM.c and OBNM.hxx (OBNM = Object Name).

      The source file contains one function per table event rule event.

    • Creates a make file to compile the generated code.

    • Runs the make file to compile the new functions and to add them into JDBTRIG.DLL.

      This consolidated DLL contains table event rule functions.

4.2.2 Adding Table Event Rules to Table Conversions

Access the Object Management Workbench form.

  1. Check out the table to which you want to attach event rules and click Design.

  2. On the Table Design form, select the Design Tools tab and click Start Table Trigger Design Aid.

  3. Select an event from the Events list.

  4. On Event Rules Design, click one of the event rule buttons and complete the event rules.

  5. Click Save to save the event rule specifications and then click Close.

  6. If you are creating a new table in Oracle's JD Edwards EnterpriseOne Table Design Aid, select the Table Operations tab and click Generate Table.


    Never perform this step on an existing table because it clears all data.
  7. On the Generate Table form, complete these fields and click OK:

    • Data Source

    • Password

  8. On the Table Design form, select the Design Tools tab and click Build Table Triggers.

  9. To review a log of the build, select Generate Header File, and then open the file that the system created.

    The creation of the table event rules is complete. The newly created or modified table event rule is called from the JD Edwards EnterpriseOne database middleware whenever the corresponding event occurs against the table.