Understanding Application Processes

Application processes are blocks of PL/SQL logic that are set to run at specific points using processes from multiple pages of an application. By default, application processes execute at the same point for every page in the application. However, you can apply conditions for specific pages to control when the process executes.

Topics in this section include:

About On Demand Application Processes

A special type of application process is the On Demand process. An On Demand application process has a Process Point of On Demand and executes when called from a page-level On Demand process. On Demand processes are useful when you have PL/SQL logic that you would like to run from different execution points across multiple pages.

Running an On Demand Process from a Page Request

You can have a page request run an On Demand process by using the following syntax:

f?p=application_id:page_id:session:APPLICATION_PROCESS=process_id

Where:

  • application_id is the application ID or alphanumeric alias

  • page_id is the page number or alphanumeric alias

  • session is the session ID

  • APPLICATION_PROCESS=process_id is the keyword APPLICATION_PROCESS= followed by either the process ID or an alphanumeric name of an application-level process having a Process Point of On Demand

When you use this syntax, the Application Express engine recognizes the request and processes it using the following rules:

  • The page number in the URL can be any page number or alias. A page number or alias is required in the request only as a syntactic placeholder because no specific page is accessed for this type of request.

  • The process authorization scheme, the application's authorization scheme, and the process conditions are supported.

  • Session state (that is, item names and values) may be set in the URL, but clear cache options are ignored.

  • Any failures of authentication, authorization, or process conditions do not result in visible error messages or other indicators of such failures and most often result in a blank page being displayed.

  • Specifying the process by name locates the first process with the specified (case-preserved) name.

Application Process Example

A shopping cart application is a good example of when you might use an application process. For example, suppose you need to display the contents of a user's shopping cart with each page view. To accomplish this, you create a region on page zero of your application that displays the values of the application-level items TOTAL_CART_ITEMS and TOTAL_PURCHASE_PRICE.

Instead of writing a process for each page to set the values of TOTAL_CART_ITEMS and TOTAL_PURCHASE_PRICE, you could write an application process of type On Load: Before Header to compute these values. Then, the Application Express engine would execute the process on each page as it renders the application. As a result, each page, would display the most current values for TOTAL_CART_ITEMS and TOTAL_PURCHASE_PRICE.

Creating an Application Process

To create an application process:

  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 Processes.

  3. Click Create.

  4. For Identification:

    1. Name - Enter a name for the application process.

    2. Sequence - Specify the sequence number for this process. The sequence number determines the order in which the process will be evaluated relative to other processes.

    3. Point - Identify the point at which this process executes.

    4. Click Next.

  5. For Source:

    1. Process Text - Enter the text that is to be the source of your process.

    2. Error Message - Enter the error message that displays if the process raises an error.

    3. Click Next.

  6. For Conditionality:

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

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

    3. Click Create Process.

About the Application Process Page

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

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

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

Accessing Application Processes Reports

After you create an application process, you can access the Utilization and History reports.

To access application processes reports:

  1. Navigate to the Workspace home page.

  2. Click Application Builder.

  3. Select an application.

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

  5. Under Logic, select Application Processes.

  6. Select one of the following tabs at the top of the page:

    • Utilization

    • History

  7. Follow the on-screen instructions.

Utilization

Click Utilization to display the Application Process Utilization page. This page displays application processes used in the current application.

History

Click History to display the Application Process History page. This page displays a history of recently changed application processes by date.