1 APEX_APPLICATION

The APEX_APPLICATION package is a PL/SQL package that implements the Oracle Application Express rendering engine. You can use this package to take advantage of many global variables. Table 1-1 describes the global variables available in the APEX_APPLICATION package.

Referencing Arrays

Items are typically HTML form elements such as text fields, select lists, and check boxes. When you create a new form item using a wizard, the wizard uses a standard naming format. The naming format provides a handle so you can retrieve the value of the item later on.

To create your own items, you can access them after a page is submitted by referencing APEX_APPLICATION.G_F01 to APEX_APPLICATION.G_F50 arrays. You can create your own HTML form fields by providing the input parameters using the format F01, F02, F03 and so on. You can create up to 50 input parameters ranging from F01 to F50, for example:

Referencing Values Within an On Submit Process

You can reference the values posted by an HTML form using the PL/SQL variable APEX_APPLICATION.G_F01 to APEX_APPLICATION.G_F50. Because this element is an array, you can reference values directly, for example:

FOR i IN 1..APEX_APPLICATION.G_F01.COUNT LOOP
htp.p('element '||I||' has a value of '||APEX_APPLICATION.G_F01(i));
END LOOP;

Note that check boxes displayed using APEX_ITEM.CHECKBOX only contain values in the APEX_APPLICATION arrays for those rows which are checked. Unlike other items (TEXT, TEXTAREA, and DATE_POPUP) which can contain an entry in the corresponding APEX_APPLICATION array for every row submitted, a check box only has an entry in the APEX_APPLICATION array if it is selected.

Converting an Array to a Single Value

You can also use Oracle Application Express public utility functions to convert an array into a single value. The resulting string value is a colon-separated list of the array element values. For example:

htp.p(APEX_UTIL.TABLE_TO_STRING(APEX_APPLICATION.G_F01));

This function enables you to reference G_F01 to G_F50 values in an application process that performs actions on data. The following sample process demonstrates how values are inserted into a table:

The application ID that contains the page or item level help you want to output.

p_flow_step_id

The page ID that contains the page or item level help you want to display.

p_show_item_help

Flag to determine if item level help is output. If this parameter is supplied, the value must be either 'YES' or 'NO', if not the default value is 'YES'.

p_show_regions

Flag to determine if region headers are output (for regions containing page items). If this parameter is supplied, the value must be either 'YES' or 'NO', if not the default value is 'YES'.

p_before_page_html

Use this parameter to include HTML between the page level help text and item level help text.

p_after_page_html

Use this parameter to include HTML at the bottom of the output, after all other help.

p_before_region_html

Use this parameter to include HTML before every region section. Note this parameter is ignored if p_show_regions is set to 'NO'.

p_after_region_html

Use this parameter to include HTML after every region section. Note this parameter is ignored if p_show_regions is set to 'NO'.

p_before_prompt_html

Use this parameter to include HTML before every item label for item level help. Note this parameter is ignored if p_show_item_help is set to 'NO'.

p_after_prompt_html

Use this parameter to include HTML after every item label for item level help. Note this parameter is ignored if p_show_item_help is set to 'NO'.

p_before_item_html

Use this parameter to include HTML before every item help text for item level help. Note this parameter is ignored if p_show_item_help is set to 'NO'.

p_after_item_html

Use this parameter to include HTML after every item help text for item level help. Note this parameter is ignored if p_show_item_help is set to 'NO'.

Example

The following example shows how to use the APEX_APPLICATION.HELP procedure to customize how help information is displayed.

In this example, the p_flow_step_id parameter is set to :REQUEST, which means that a page ID specified in the REQUEST section of the URL controls which page's help information to display (see note after example for full details on how this can be achieved).

Also, the help display has been customized so that the region sub-header now has a different color (through the p_before_region_html parameter) and also the ':' has been removed that appeared by default after every item prompt (through the p_after_prompt_html parameter).

This example also tells the browser to redirect to http://apex.oracle.com/ and immediately stops further processing. But, this time the code also contains a WHEN OTHERS exception handler which deals with the apex_application.e_stop_apex_engine used by apex_application.stop_apex_engine.

begin
... code which can raise an exception ...
owa_util.redirect_url('http://apex.oracle.com');
apex_application.stop_apex_engine;
exception
when apex_application.e_stop_apex_engine then
raise; -- raise again the stop Application Express engine exception
when others then
...; -- code to handle the exception
end;

Scripting on this page enhances content navigation, but does not change the content in any way.