20 Working with Event Rules

This chapter contains the following topics:

20.1 Understanding Events in JD Edwards EnterpriseOne

As a report is processed, the system pauses at specific points to process attached logic. These points are called events. You can use these events to attach logic. In JD Edwards EnterpriseOne, you create logic using event rules. Event rules are logic statements that are processed when an event, such as a page break, is encountered. Events can be attached to the report and to the report components, such as variables, constants, and sections.

The event to which you attach event rules varies depending on the purpose of the event rule and the type of section in which the event occurs. For example, if you are adding event rules to columnar or group sections, you typically use the Do Section event. In tabular sections, you typically attach event rules to the Do Tabular Break, Do Balance Auditor, and Column Inclusion events. When you attach event rules to a variable, you can use the Do Variable event, although typically, you use the Do Section event for more efficient processing. Smart fields that are included in a tabular section are automatically attached to the Column Inclusion event.

Each event is triggered at a different time during the processing of the report. You should become familiar with the process flow of events so that you can determine on which event to attach event rules. If you attach event rules to the wrong event, the appropriate data might not be available to successfully process the event rule logic.

20.2 Creating Event Rules

This section provides an overview of event rules, lists the prerequisites, and discusses how to:

  • Create If statements.

  • Create simple event rule assignments.

  • Create assignments using the Expression Manager.

20.2.1 Understanding Event Rules

You create event rules in Oracle's JD Edwards EnterpriseOne Report Design Aid (RDA) using the Event Rules Design form. You create event rules by selecting from available components. The event rules are embedded in the report template; they cannot be used anywhere else in the system.

Event rules can be written on any event. However, you must understand the order in which the events are processed to determine the correct event on which to place event rules.

If the event rules affect an individual field, you can place the event rules on one of that field's events or on one of the section events. Typically, event rules are placed on section events for more efficient performance.

This table identifies the types of event rule statements that you can create:

Event Rules Components Description
If/Else/While Statements Enable you to define the criteria for which the logic should be processed. The first line of an If/While statement typically begins with the If operator. Subsequent lines begin with either an And or an Or operator.

An else statement is used to link two options. For example: If Search Type is equal to E or Search Type is equal to C <do this> Else <do that>. You can embed multiple If statements in event rules and other statements inside of the if statement.

Assignments and Expressions Enable you to assign a value to a field. For example: RV Business Unit = PC Business Unit. Also enable you to create expressions to populate fields.
System Functions Enable you to use special functions that are provided by the system. Only system functions that are relevant to the report component and event are presented for use.
Business Functions Enable you to use logic that is provided by the system. Business functions are either C business functions or business function event rules that can be called from an event.
Event Rules Variables Enable you to create variables that can be used inside event rules. These variables are typically used to store values to be used in event rule logic.
Table I/O Enables you to use special table input and output functions that are provided by the system to fetch and update data.
Report Interconnects Enable you to call another report from event rules.

Fields that are available for use in event rules are represented by a two-character, alphabetical code. This code indicates the source of the field and determines how the field data is used at runtime. Field types that are available for event rules depend on the fields that are included in the report section.

This table describes the field types that could be available in Event Rules Design:

Prefix Code Description
BC Business view columns. Columns that are included in the attached business view. These columns are populated with values from the database when a fetch is performed, and those values are the values that are saved when you add or update.
PC Previous business view columns. Columns that are included in the attached business view. However, these fields are populated with the previous value for the selected business view field.
PO Processing option fields. Values that are passed from processing options.
PV Previous report variables. Fields that are populated with the previous value for the selected report variable.
RC Report constants. Column headings in columnar sections and constants in group sections.
RS Report sections. Values that are not typically used when you are creating event rule assignments.
RV Report variables. Column variables in columnar sections and variables in group sections.
SL System values. Values that are fetched by the system and include information such as user IDs, environment names, version names, and report names.
TV Text variables. Fields that you create from the Section menu prior to creating the event rules. These fields are used in assignments.
VA Event rule variables. Variables that you define in event rules using data items. These fields are used in assignments for storing values for further processing.

20.2.1.1 Expression Manager

The Expression Manager enables you to create expressions for event rule assignments. The Expression Manager provides a calculator for creating calculations.

This table describes other functions that are available in the Expression Manager:

Functions Description
Date Enables you to calculate data such as days_between, months_between, and date_today.
Time Zone Enables you to calculate data such as utc_get_day, utc_get_hour, and utc_add_years.
General Enables you to calculate data such as abs( ), exp( ), and round ( ).
Trig Enables you to calculate data such as cos( ), log( ), and sin ( ).
Text Enables you to calculate data such as concat( ), ltrim( ), and substr ( ).

20.2.2 Prerequisites

Before you begin creating event rules, ensure that you:

  • Create a batch application object.

  • Complete the design of the report template.

20.2.3 Creating If Statements

Open a report template in RDA.

  1. Click the object (section, variable, data item, and so forth) to which you want to attach event rules.

    If you are working with columnar or group sections, click the section.

  2. From the Edit menu, select Event Rules.

    You can also right-click the object and select Event Rules.

  3. On the Event Rules Design form, select an event from the drop-down menu of the events list.

    For example, select the Do Section event. This event is the most commonly used event in columnar and group sections.

  4. From the Insert menu, select If/While.

    You can also click the If/While button on the toolbar.

  5. On the Criteria Design form, define the criteria for the event rules.

  6. Click OK to save the If statement and return to the Event Rules Design form.

    The If statement appears on the Event Rules Design form.

    You can move lines of the event rules to other locations. Select a line and drag it to the desired position.

Note:

Changing the sequence of statements in event rules can result in improper syntax. If you detect syntax errors, you can either disable the event rule and continue, or edit the event rule to eliminate the errors.

20.2.4 Creating Simple Event Rule Assignments

Open a report template in RDA.

  1. Click the object (section, variable, data item, and so forth) to which you want to attach event rules.

  2. From the Edit menu, select Event Rules.

  3. On the Event Rules Design form, select an event from the events drop-down list box.

    The system displays a green plus sign (+) next to events that include attached event rules.

  4. Click the existing statement to add a statement to follow it.

  5. Select Assignment/Expression from the Insert menu.

  6. On the Assignment form, in the To Object list, select the field to which you want to assign a value.

    For example, the to object might be the report variable of a column that you inserted into the report.

    When an object is selected, the selected field appears under the To Object heading. This field is the recipient of the assigned value.

  7. Select an object from the From Object/Literal list, and click OK.

    The options that are listed in From Object/Literal depend on the field that is selected as the to object.

  8. On the Event Rules Design form, select Save from the File menu.

    You can also click the check mark on the toolbar.

20.2.5 Creating Assignments Using the Expression Manager

Open a report template in RDA.

  1. Click the object (section, variable, data item, and so forth) to which you want to attach event rules.

  2. From the Edit menu, select Event Rules.

  3. On the Event Rules Design form, select an event from the events drop-down list box.

  4. Click the existing statement to add a statement to follow it.

  5. Select Assignment/Expression from the Insert menu.

  6. On the Assignment form, in the To Object list, select the field to which you want to assign a value.

  7. Click the ⌊(x) button at the end of the From Object/Literal field.

  8. On the Expression Manager form, enter an expression using the fields in the Available Information list, the calculator, and the Advanced Functions.

  9. When the expression is complete, click OK.

  10. On the Event Rules Design form, select Save from the File menu.

20.3 Creating and Using Text Variables

This section provides an overview of text variables, lists the prerequisites, and discusses how to:

  • Create text variables.

  • Use text variables in assignments.

20.3.1 Understanding Text Variables

You can use text variables to hold a literal string for use in event rules. Text variables are easier to translate into multiple languages and are easier to maintain than hard-coded literal strings.

You create text variables in RDA. The text variables are then available in the Event Rules Design form for use in If statements and assignments for a specific report section. Text variables are embedded in the report template; they cannot be used anywhere else in the system.

20.3.2 Prerequisites

Before you begin creating and using text variables, ensure that you:

  • Create a batch application object.

  • Complete the design of the report template.

20.3.3 Creating Text Variables

Open a report template in RDA.

  1. Click the section to which you want to add text variables.

  2. From the Section menu, select Text Variables.

  3. On the Text Variables form, enter the text that you want to appear on the report under the Text String heading.

  4. Press Enter or click Add, and then click OK.

    You must press Enter after each entry for RDA to recognize the entry. When you press Enter or click Add, another blank line appears.

20.3.4 Using Text Variables in Assignments

Open a report template that includes text variables in RDA.

  1. Click the section to which you added the text variables, and select Event Rules from the Edit menu.

  2. On the Event Rules Design form, select an event from the events drop-down list box.

  3. Click the existing statement to add a statement to follow it.

  4. Create an assignment by selecting Assignment/Expression from the Insert menu.

    You can also click the x= button on the toolbar.

  5. On the Assignment form, select the field to which you want to assign a value from the To Object list.

  6. Select the text variable in the From Object/Literal field, and click OK.

    Refer to the prefix code table in the Understanding Event Rules section.

    The Event Rules Design form displays the assignment using the text variable in addition to any existing event rules.

  7. Click the check mark on the toolbar to save and quit Event Rules Design.

20.4 Calling System Functions in Event Rules

This section provides an overview of system functions, lists the prerequisites, and discusses how to use system functions in event rules.

20.4.1 Understanding System Functions

System functions are predefined sets of logic that are shipped with the JD Edwards EnterpriseOne product. These functions enable you to perform specialized processing without adding custom code. This table shows some examples of frequently used system functions:

System Functions Description
Hide Object and Show Object. Enables you to hide and show objects within a section.
Hide Section and Show Section. Enables you to hide and show sections within a report.
Do Custom Section. Enables you to call a custom section.
Set Selection Append Flag and Set Sequence Append Flag. Enables you to set append flags for defining data selection and data sequencing entered into processing option templates.
Set User Selection and Set User Sequence. Enables you to define data selection and data sequencing entered into processing option templates.
Stop Batch Processing and Stop Event Processing. Enables you to stop processing when unfavorable circumstances are met.
Use Data Sel/Seq From a Section. Enables you to adopt the data selection and data sequencing from another report section.

20.4.2 Prerequisites

Before you begin calling system functions in event rules, ensure that you:

  • Create a batch application object.

  • Complete the design of the report template.

20.4.3 Using System Functions in Event Rules

Open a report template in RDA.

  1. Click the object (section, variable, data item, and so forth) to which you want to attach event rules.

  2. From the Edit menu, select Event Rules.

  3. On the Event Rules Design form, select an event from the events drop-down list box.

  4. Click the existing statement to add a statement to follow it.

  5. From the Insert menu, select System Function.

    You can also click the System Function button on the toolbar.

  6. On the Function Selection tab of the System Functions form, expand each folder to view all available functions.

  7. Select an appropriate system function.

    For example, to hide an object, expand the Object folder and select the Hide Object system function.

  8. Select the Parameter Mapping tab to define the parameters.

    If you double-click the system function, the Parameter Mapping tab is accessed automatically.

  9. On the Parameter Mapping tab, select an appropriate field from the Available Objects list.

    For example, to hide an object, select the object that you want to hide from the Available Objects list.

  10. Click the right arrow to move the object to the Value column under Parameters.

    Not all system functions require parameter mappings.

  11. Click OK to return to Event Rules Design.

  12. On the Event Rules Design form, click the check mark to save and return to RDA.

20.5 Creating Event Rule Variables

This section provides an overview of event rule variables, lists the prerequisites, and discusses how to create event rule variables in event rules.

20.5.1 Understanding Event Rule Variables

Event rule variables are objects that you create based on the characteristics of a data dictionary field. However, the variables are not stored in the data dictionary. Rather, each variable exists only within the report where it was created. After you create the variable, it is available for use in event rules.

When you create an event rule variable, you indicate the scope. This table describes the scopes that are available for event rule variables:

Scope Description
Report Enables you to use the event rule variable in any event in any section of the report. Upon completion of the variable, the system adds a prefix of rpt to the variable name.
Section Enables you to use the event rule variable in multiple events of the selected section. Upon completion of the variable, the system adds a prefix of sec to the variable name.
Event Enables you to use the event rule variable in the event where it was created. Upon completion of the variable, the system adds a prefix of evt to the variable name.

The recommended naming convention for event rule variables is to include:

  • The Hungarian Notation at the beginning of the name.

  • The data item alias at the end of the name, preceded by an underline.

  • No spaces in the name.

For example, an event rule variable that you create using the Address Number data item might be named sec_mnEmployeeNumber_AN8. The letters sec indicate that the event rule variable is available in all events of the report section. The letters mn indicate that the field is a math numeric field type. These prefixes are added to the event rule variable name by the system. Employee Number is the name that the creator gave the variable. The characters AN8 indicate that the variable shares the same characteristics as the Address Number data item.

20.5.2 Prerequisites

Before you begin creating event rules variables, ensure that you:

  • Create a batch application object.

  • Complete the design of the report template.

20.5.3 Creating Event Rule Variables in Event Rules

Open a report template in RDA.

  1. Click the section to which you want to attach event rule variables, and select Event Rules from the Edit menu.

  2. On the Event Rules Design form, select an event from the events drop-down list box.

    This step is required only if the event rule variable is used for a specific event. If the variable is required for the entire section or report, you do not need to select an event prior to creating the variable.

  3. From the Insert menu, select Variables.

    You can also click the Variables button on the toolbar.

  4. On the Event Rules Variables form, enter the alias of the appropriate data item in the DD Item field, and click Add.

    Select a data item that possesses the characteristics that are required by the variable.

    If you do not know which data item you need, you can leave the DD Item field empty, and click Add. You can then use the Variable Options Selection form to search for an appropriate data item.

  5. On the Variable Options Selection form, select an appropriate Scope option.

  6. In the Name field, enter a meaningful name using the recommended naming conventions, and click Finish.

    The Event Rules Variables form displays the event rule variable that you just created.

  7. To modify the scope of the event rule variable, click the variable that you want to edit, and then click the Edit button.

  8. On the Variable Options Selection form, make any modifications that are required, and click Finish.

  9. Click OK to return to Event Rules Design.

  10. On the Event Rules Design form, click the check mark to save and return to RDA.

20.6 Using the Do Section Event Versus the Column Inclusion Event

This section provides an overview of the Do Section and Column Inclusion events, lists the prerequisites, and discusses how to use the Column Inclusion event.

20.6.1 Understanding the Do Section and Column Inclusion Events

The most common event for a group or columnar section is the Do Section event. For group or columnar sections, this event occurs after each record is fetched.

The most common event for a tabular section is the Column Inclusion event. For a tabular section, the Do Section event is processed only at each level break, while the Column Inclusion event is processed after each record is fetched.

Regardless of the section type, do not use the Column Inclusion event when you are performing a calculation between columns (such as when calculating variances) or between variables within a column. For these situations, use the Do Section event.

When using the Column Inclusion event, you attach event rules to individual columns in the section.

20.6.2 Prerequisites

Before you begin using the Column Inclusion event, ensure that you:

  • Create a batch application object.

  • Complete the design of the report template using a tabular section.

20.6.3 Using the Column Inclusion Event

Open a tabular section report template in RDA.

  1. In the tabular section, click the column variable to which you want to attach event rules.

  2. From the Edit menu, select Event Rules.

  3. On the Event Rules Design form, select Column Inclusion from the events drop-down list box.

  4. Create event rules using the appropriate event rule components.

    For example, to create an if/while statement, select If/While from the Insert menu.

  5. Click the check mark to save and return to RDA.

20.7 Creating Custom Sections

This section provides an overview of custom sections, lists the prerequisites, and discusses how to set up custom sections.

20.7.1 Understanding Custom Sections

Custom sections enable you to control, through event rules, the information that prints on a report. You can include business view fields, variables, and data dictionary fields in custom sections. The number of custom sections that you can add to a report is limited only by your system's performance. Custom sections are allocated and processed like any other section.

This table describes uses for custom sections:

Custom Section Usage Description
Force page breaks. Create a custom section with no objects and then activate the Page Break After Print option in that section.
Perform logic. Create a custom section and add event rules to perform percent of total calculations to be used by the level-one section.
Present additional information when stated criteria is met. Create an accounts receivable report that displays the payment history of customers. Add a custom section that presents account receivables by aging categories. Call the custom section only if a customer is delinquent. When the batch engine encounters a record that meets the past due criteria, the custom section prints. The custom section does not print for any records that do not have a past due amount.

20.7.1.1 Logic for Custom Sections

When you use a custom section, you must specify the section as conditional in the section properties. Use the Do Custom Section system function to call the custom section. You can use the Do Custom Section system function in columnar, group, or tabular sections. You must attach the system function to the section that precedes the custom section. For example, to process a custom section after a columnar section, call the custom section from the Do Section event of the columnar section. Likewise, to process a custom section after a level break footer, call the custom section from the Init Lvl Brk Footer Section event.

You can call a custom section from any report section. Furthermore, you can use any event rule logic along with a custom section, such as If/While statements, business functions, and table I/O.

You can call a custom section from any event except the Initialize Section event. If you call a custom section from the Initialize Section event, the report does not process.

20.7.2 Prerequisites

Before you begin creating custom sections, ensure that you:

  • Create a batch application object.

  • Complete the design of the report template.

20.7.3 Setting Up Custom Sections

Open a report template in RDA.

  1. Click the section from which you want to call the conditional section.

  2. From the Edit menu, select Event Rules.

  3. Select the Do Section event from the events drop-down list box.

  4. From the Insert menu, select If/While and define the criteria for displaying the conditional section.

  5. Click the If/While statement, and select System Function from the Insert menu.

  6. On the Function Selection tab, expand the Section folder and double-click Do Custom Section.

  7. On the Parameter Mapping tab, select the report section that you want to display when the defined criteria is met.

    The section appears in the Values column of the Parameters table.

  8. Click OK, and save the event rules.

  9. In the RDA workspace, double-click the report section that you selected to appear only when the defined criteria is met.

  10. On the appropriate section properties form, select the Advanced tab.

  11. Select the Conditional option, and click OK.

20.8 Accessing BrowsER for Report Templates

This section provides an overview of BrowsER, lists the prerequisites, and discusses how to access BrowsER.

20.8.1 Understanding BrowsER

Use Oracle's JD Edwards EnterpriseOne BrowsER to view event rules for an entire report or batch version. JD Edwards EnterpriseOne BrowsER displays the report sections in a hierarchical structure. When you expand a section, you see a section node and nodes for each object within the section. Event rules that are attached to the section appear under the section node. All event rules that are attached to an object appear under the appropriate object node.

A plus sign next to a node indicates that event rules are attached. When you expand a node with a plus sign, an event node on which the event rules are attached appears with a plus sign. When you expand the event node, you can review the event rules that are attached to the event. You can disable and enable one or more event rules from JD Edwards EnterpriseOne BrowsER. This is useful for troubleshooting event rules for an entire report or batch version.

You can access JD Edwards EnterpriseOne BrowsER from multiple locations in JD Edwards EnterpriseOne:

  • Oracle's JD Edwards EnterpriseOne Report Design Aid (RDA).

    Open a report template in RDA, and select BrowsER from the View menu.

  • Oracle's JD Edwards EnterpriseOne Object Management Workbench (OMW).

    Select a report template, and access the Design Tools tab.

  • Oracle's JD Edwards EnterpriseOne Batch Versions.

    Select a batch version, and from the Advanced Operations form, select Report BrowsER from the Form menu.

20.8.2 Prerequisites

Before you access JD Edwards EnterpriseOne BrowsER for report templates, ensure that you:

  • Create a batch application object.

  • Complete the design of the report template.

  • Include event rules in the report template.

20.8.3 Accessing BrowsER

Access OMW.

  1. From a project, select the report template that you want to review.

    For example, select the R014021 One Line Per Address report template.

  2. Click Design.

  3. Select the Design Tools tab.

  4. Click Browse Event Rules.

  5. On the Browsing form, expand the nodes for each report section.

    If no other nodes under the report section can be expanded, no event rules exist for that report section.

  6. Expand additional nodes until you locate event rules.

    You can disable and enable event rules for the entire report template from this form.