Home > Oracle Forms Generation Cap... > Oracle Forms Modules > Implementing Business Logic
Previous |
Next |
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. Note that these database objects do not need to be altered when used within the Oracle Application Express development environment.
In order 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. Note that Oracle Forms triggers, program units, and PL/SQL library code are not automatically generated except for POST-QUERY
triggers. POST-QUERY
triggers can be incorporated into Enhanced Queries as part of the block definition and subsequently included in the Oracle Application Express application.
Oracle Application Express uses processes, computations, and validations to implement such business logic. Before undertaking the post-generation 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. For more information, see Oracle Application Express Application Builder User's Guide.
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. For more information, see "Understanding Page Processes" in Oracle Application Express Application Builder User's Guide.
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. Application-level processes can be called form any page within the application and may be called On Demand which 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.
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. For more information, see "Understanding Page Computations" and "Understanding Application Computation in Oracle Application Express Application Builder User's Guide.
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 is displayed and subsequent page processes and computations will not occur. For more information, see "Understanding Validations" in Oracle Application Express Application Builder User's Guide.
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.