16.6 Understanding Application Computations
Create an application computation to set the value of a single page or application-level item. Application computations run at the same point across multiple pages in an application.
Tip:
To learn more about execution behavior in the case of a validation error, see "What Happens When a Validation Fails?."
- About Application Computations
- About Application Computations that Execute On New Instance
- Creating an Application Computation
- Accessing the Application Computation History Report
Parent topic: Managing Computations, Validations, and Processes
16.6.1 About Application Computations
Application Computations are units of logic that set the value of a single page or application-level item and are run at the same point across multiple pages in an application. Like page-level computation, application computations can be based on static values, item values, PL/SQL, or SQL.
A common use of an application item is to store the value of the last page viewed in the application. By storing the value in an item, you can add a back button and then redirect the user to the page number captured by the computation. This type of computation works well, for example, when you need to enable users to back out of an error page.
The following is an example of a computation that stores the last page visited. In this example, the computation:
-
Stores the last application page visited to an item named
LAST_PAGE
-
Checks that the value of a
CURRENT_PAGE_ITEM
is of type PL/SQL Function Body with a Computation body of:BEGIN :LAST_PAGE := nvl(:CURRENT_PAGE,:APP_PAGE_ID); :CURRENT_PAGE := :APP_PAGE_ID; RETURN :LAST_PAGE; END;
Parent topic: Understanding Application Computations
16.6.2 About Application Computations that Execute On New Instance
Typically an application computation runs at the same point across multiple pages in an application. The exception is computations having a Computation Point of On New Instance. These types of computations are useful when you only need to retrieve information once within a user's session. For example, if the application items do not depend on the logged in user, you can initialize them using the Computation Point On New Instance. To look up information that depends on the user, you can also use After Authentication.
If you configure applications to share the same session by setting the same cookie name in the authentication scheme, On New Instance and After Login, the application processes fire whenever Oracle Application Express first processes a request for the application (that is, On New Instance), or processes a request of an authenticated user for the application (that is, After Authentication).
Parent topic: Understanding Application Computations
16.6.3 Creating an Application Computation
To create an application computation:
- Navigate to the Shared Components page:
- Under Logic, select Application Computations.
- Click Create.
- Edit the following attributes:
- Item, Sequence - Specify the sequence for this component. The sequence determines the order of evaluation.
- Item, Computation Item - Select the item this computation affects.
- Frequency, Computation Point - Select a process point at which this computation should be performed. Selecting After Submit causes the computation to be performed only after the page is displayed and then submitted.
- Computation, Computation Type - Select the manner in which this computation is performed.
- Computation, Computation - Enter the computation logic that corresponds to the computation type. See field-level Help for examples.
- Computation, Computation Error Message - Enter the error message that displays if the computation fails.
- Authorization, Authorization Scheme (optional) - Select an authorization scheme which must evaluate to True in order for this computation to execute.
- Condition, Condition Type (optional) - Select a condition type that must be met in order for this computation to execute.
- Build Option (optional) - Select a build option for this component.
- Click Create Computation.
See Also:
Parent topic: Understanding Application Computations
16.6.4 Accessing the Application Computation History Report
Once you create an application computation, you can view the Application Computation History report. The Application Computation History report displays a history of recently changed application computations by date.
To access the Application Computation History report:
See Also:
Parent topic: Understanding Application Computations