8.9 Understanding 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.

Tip:

To learn more about execution behavior in the case of a validation error, see "What Happens When a Validation Fails?"

Topics:

8.9.1 About Application Computations

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;
    

8.9.1.1 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. This type of computation only runs when a user first accesses your application. This type of computation is useful when you need to only retrieve information once within a user's session (for example, to retrieve a user's job title).

8.9.2 Creating an Application Computation

To create an application computation:

  1. Navigate to the Shared Components page:

    1. On the Workspace home page, click Application Builder.

    2. Select an application.

    3. On the Application home page, click Shared Components.

      The Shared Components page appears.

  2. Under Logic, select Application Computations.

  3. Click Create.

  4. Under Item:

    1. Sequence - Specify the sequence for this component. The sequence determines the order of evaluation.

    2. Computation Item - Select the item this computation affects.

  5. For 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.

  6. Under Computation:

    1. Computation Type - Select the manner in which this computation is performed.

    2. Computation - Enter the computation logic that corresponds to the computation type.

    3. Computation Error Message - Enter the error message that displays if the computation fails.

  7. For Authorization Scheme (optional), select an authorization scheme which must evaluate to True in order for this computation to execute.

  8. Under Conditions (optional):

    1. Condition Type - Select a condition type that must be met in order for this computation to execute.

    2. Expression 1 and Expression 2 - Use these attributes to conditionally control whether the computation executes. Enter values in this attribute based on the specific condition type you select. The computation executes if the specified condition is met.

  9. For Build Option (optional), select a build option for this component. See "Using Build Options to Control Configuration".

  10. Click Create Computation.

8.9.2.1 About the Application Computations Page

Once you create an application computation, it appears on the Application Computations page. You control how the page displays by making a selection from the View list. Available options include:

  • Icons (the default) displays each computation as a large icon. To edit a computation, click the appropriate icon.

  • Details displays each application process as a line in a report. To edit a computation process, click the name.

8.9.3 Accessing the Application Computation History Report

Once you create an application computation, you can view the Application Computation History report.

To access the Application Computation History report:

  1. Navigate to the Workspace home page.

  2. Click the Application Builder icon.

  3. Select an application.

  4. When Application Builder appears, click Shared Components.

  5. Under Logic, select Application Computations.

  6. Select the History tab at the top of the page.

    This Application Computation History report displays a history of recently changed application computations by date.

  7. You can customize the appearance the page using the Search bar at the top of the page. Available controls include:

    • Select columns to search - Resembles a magnifying glass. Click this icon to narrow your search. To search all columns, select All Columns.

    • Text area - Enter case insensitive search criteria (wildcard characters are implied) and then Go.

    • Go button - Executes a search or applies a filter.

    • View Icons - Displays each computation as a large icon. To edit a computation, click the appropriate icon.

    • View Report - Displays each computation as a line in a report. To edit a computation, click the name.

    • Actions menu - Use the Actions menu to customize the report view. See "About the Actions Menu".