Previous
Previous
 
Next
Next

Managing User Preferences

You can use preferences to store values for a specific Application Express user across distinct sessions. Once set, these preferences can be removed programmatically or manually. You can set user preferences by creating a page process, by the calculation of a preference Item Source Value, or programmatically by using a PL/SQL API.

Topics:

Viewing Preferences by User

To view the preferences by user:

  1. Log in to Oracle Application Express. See "Logging In to Oracle Application Express" in Oracle Application Express Application Builder User's Guide.

    The Workspace home page appears.

  2. Click the Administration icon.

  3. On the Administration page, click Manage Service.

  4. Under Manage Meta Data, click Session State.

  5. Click Preferences by User.

    The Preferences by User page appears.

  6. You can customize the appearance the page using the Search bar at the top of the page. See "Customizing Interactive Reports" in Oracle Application Express Application Builder User's Guide.

Viewing Current User Preferences

To view current user preferences:

  1. Log in to Oracle Application Express. See "Logging In to Oracle Application Express" in Oracle Application Express Application Builder User's Guide.

    The Workspace home page appears.

  2. Click the Administration icon.

  3. On the Administration page, click Manage Service.

  4. Under Manage Meta Data, click Session State.

  5. Click Report Current User Preferences.

    The Current user Preferences page appears.

  6. You can customize the appearance the page using the Search bar at the top of the page. See "Customizing Interactive Reports" in Oracle Application Express Application Builder User's Guide.

Purging Preferences for a Specific User

You can purge preferences for a specific user on the Purge Preferences page.

To purge preferences for a specific user:

  1. Navigate to the appropriate Page Definition. See "Accessing a Page Definition" in Oracle Application Express Application Builder User's Guide.

  2. Click the Administration icon.

  3. On the Administration page, click Manage Service.

  4. Under Manage Meta Data, click Session State.

  5. Click Purge preferences by User.

    The Purge Preferences page appears.

  6. Select a specific user and click Report.

    A report appears at the bottom of the page.

  7. To purge the displayed user preferences, click Purge User Preferences.

Purging Current User Preferences

To purge preferences for the current user:

  1. Log in to Oracle Application Express. See "Logging In to Oracle Application Express" in Oracle Application Express Application Builder User's Guide.

    The Workspace home page appears.

  2. Click the Administration icon.

  3. On the Administration page, click Manage Service.

  4. Under Manage Meta Data, click Session State.

  5. Click Purge Preferences for Current User.

    The Purge Preferences page appears.

  6. Select a user and click Report.

  7. To purge preferences, click Purge User Preferences.

Setting User Preferences

You can set user preferences within your application through the creation of a page process, by creating a preference item, or programmatically.

Topics:

Setting User Preferences Using a Page Process

To set user preference values by creating a page process:

  1. Navigate to the appropriate Page Definition. See "Accessing a Page Definition" in Oracle Application Express Application Builder User's Guide.

  2. Access the Create Page Process Wizard:

    • Tree view- Under the appropriate event, locate Processes. Right-click and select Create.

    • Component view - Under Processes, click the Create icon.

  3. For process category, select Session State and click Next.

  4. For the process type, select Reset Preferences (remove all preferences for current user) and click Next.

  5. Specify a name, sequence, and processing point and click Next.

  6. Follow the on-screen instructions and click Create Process.

Setting the Source of an Item Based on a User Preference

You can set the source of an item based on a user preference by defining the item source type as Preference.

To define the source of item based on a user preference:

  1. Navigate to the appropriate Page Definition. See "Accessing a Page Definition" in Oracle Application Express Application Builder User's Guide.

  2. Access the Create Page Item Wizard:

    • Tree view- Under Page Rending, expand Regions, right-click on Items, and select Create Page Item.

    • Component view - Component view - Under Items, click the Create icon.

  3. For the item type, select Hidden and click Next.

  4. For Hidden Item Type, select one of the following and click Next:

    • Hidden - A hidden item is exposed in the HTML form but not displayed.

    • Hidden an Protected - A hidden and protected item is also exposed in the HTML form but not displayed. However, its value cannot be changed when the page is posted.

  5. Specify the item name, sequence, and region and click Next.

  6. For Source, select Source Type of Preference, enter the appropriate Source Value, and click Next. If the item source is null the default value is used.

    To learn more about a specific field, see item Help.

  7. Click Create Item.

Setting User Preferences Programmatically

To set or reference user preferences programmatically, you must use a PL/SQL API. User-level caching is available programmatically. You can use the SET_PREFERENCE procedure to set a user level preference called NAMED_PREFERENCE. For example:

APEX_UTIL.SET_PREFERENCE(
 p_preference=>'NAMED_PREFERENCE',
 p_value =>:ITEM_NAME);

You can reference the value of a user preference using the function GET_PREFERENCE. For example:

NVL(APEX_UTIL.GET_PREFERENCE('NAMED_PREFERENCE'),15)

In the previous example, the preference would default to the value 15 if the preference contained no value.


See Also:

"GET_PREFERENCE Function and "SET_PREFERENCE Procedure in Oracle Application Express Application Builder User's Guide

Removing User Preferences Programmatically

To remove user preferences programmatically, you must use a PL/SQL API. You can use the REMOVE_PREFERENCE procedure to remove a user level preference called NAMED_PREFERENCE. For example:

APEX_UTIL.REMOVE_PREFERENCE(
p_preference=>'NAMED_PREFERENCE');

Resetting User Preferences Using a Page Process

You can reset user preferences by creating a page process and selecting the Reset Preferences process type.

To reset user preferences using a page process:

  1. Navigate to the appropriate Page Definition. See "Accessing a Page Definition" in Oracle Application Express Application Builder User's Guide.

  2. Access the Create Page Process Wizard:

    1. Tree view- Under the appropriate event, locate Processes. Right-click and select Create Process.

    2. Component view - Under Processes, click the Create icon.

  3. For the process category, select Session State and click Next.

  4. For the process type, select Reset Preferences (remove all preferences for current user) and click Next.

  5. Specify a name, sequence, and processing point and click Next.

  6. Follow the on-screen instructions.

  7. Click Create Process.