Implementing Business Logic

The differences between how business logic works in Oracle Forms and how similar functionality works in an Oracle Application Express application is explained in the following section.

About Implementing Business Logic

Within Oracle Forms applications, business logic is often interspersed with Oracle Forms user interface functionality. The Oracle Forms user interface functionality used to manipulate the screen (for example, go_block, go_item, set_item_property and so on) are often not appropriate within Oracle Application Express due to the inherent differences in the user interface.

Business logic can be found in Oracle Forms triggers and program units, or in PL/SQL libraries. The business logic can be written directly into the objects as SQL or PL/SQL. This code may in turn call database packages, procedures, or functions. The underlying tables may also have database triggers defined which implement business logic.

Because database triggers operate on the underlying tables regardless of the user interface, they do not need to be altered when converting an application to Oracle Application Express. You can call database packages, procedures, or functions from Oracle Application Express because it also uses SQL and PL/SQL. These database objects do not need to be altered when used within the Oracle Application Express development environment.

To re-implement the business logic defined within Oracle Forms you must analyze the triggers, program units, and PL/SQL libraries and manually write corresponding logic within Oracle Application Express.

Oracle Application Express uses processes, computations, and validations to implement such business logic. Before creating the initial application task of re-implementing business logic, it is important to understand how and when to invoke the various types of processes, computations, and validations. It is also important to understand how conditional processing can be applied to these types of components to customize the circumstances under which they execute.

About Processes

Processes are logic controls used to execute data manipulation language (DML) or PL/SQL. A process performs an action at a specified point during the rendering or submission of the page. For example, you can create a process to execute logic or to make a call to the Application Express engine. A process is a unit of logic that runs when a specific event occurs, such as loading or submitting a page.

Processes can be defined as either an application-level process or a page-level process. From a functional perspective, there is no difference between page-level and application-level processes. You can call application-level processes form any page within the application. Calling them On Demand is especially useful when you have PL/SQL logic that you would like to run from different execution points across multiple pages. Page-level processes can only be called from the page on which they are defined.

See Also:

"Understanding Page Processes" in Oracle Application Express App Builder User’s Guide.

About Computations

Computations are units of logic used to assign a value to an identified item when a page is submitted or displayed.

Computations can be defined as either an application-level computation or a page-level computation. Most application-level computations are performed for every page in an application. In contrast, computations created at the page-level only execute when that page is rendered or processed.

See Also:

About Validations

Validations enable you to create logic controls to verify whether user input is valid. For example, a validation can check whether a value has been entered into a mandatory field. When a validation fails then an error message displays and subsequent page processes and computations do not occur.

There are two distinct types of validations:

  • Item-level validations which are specific to a single item.

  • Page-level validations which do not apply to any single item, but apply to an entire page.

There are several validation methods:

  • SQL - Compares item values to data in the database.

  • PL/SQL - Enables you to enter complex logic to validate entered data.

  • Item Level Null - Checks if an item's value in session state is NULL.

  • Item String Comparison - Compares the value of an item to a specific string.

  • Regular Expression - Provides a method to describe text patterns.

See Also:

"Understanding Validations" in Oracle Application Express App Builder User’s Guide