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 and Resetting Preferences for the Current User

To manage user preferences for the current user:

  1. Navigate to the Workspace home page.

  2. Click Manage Services on the Administration list.

    The Manage Services page appears.

  3. Under Session State, click Manage Preferences.

    The Manage Preferences page appears.

  4. To view preference information about the current user, click Report Current User Preferences.

    The Current User Preferences page appears.

  5. To view and reset preferences for the current user, click Purge Preferences for Current User. On the Purge Preferences page, click the appropriate button:

    • Reset Preferences

    • View Preferences

Viewing Preferences by User

To view the preferences for specific users:

  1. Navigate to the Workspace home page.

  2. Click Manage Services on the Administration list.

    The Manage Services page appears.

  3. Under Session State, click Manage Preferences.

    The Manage Preferences page appears.

  4. To view preference information about a specific user, click Preferences by User.

    Use the search bar at the top of the page to narrow the display.

  5. To view and reset preferences for the current user:

    1. Click Purge Preferences by User.

    2. Select a user from the list and click Report.

      A report appears.

    3. To purge user 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. Under Processes, click the Create icon.

    The Create Page Process Wizard appears.

  3. For the process category, select Session State.

  4. For the process type, select one of the following:

    • Set Preference to value of item

    • Set Preference to value of item if item is not null

  5. Specify a process name, sequence, and processing point.

  6. Specify the preference value in the field provided using the format:

    PreferenceName:Item
    
  7. Click Page Items to see a list of available items.

  8. 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. Under Items, click the Create icon.

    The Create Item Wizard appears.

  3. For the item type, select Hidden.

  4. Specify the Item Name, sequence, and region.

  5. From the Item Source list, select Preference.

  6. In Item Source Value, enter the name of the preference.

  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. Under Processes, click the Create icon.

    The Create Page Process Wizard appears.

  3. For the process category, select Session State.

  4. From Type, select Reset Preferences.

  5. Specify a process name, sequence, and process point.

  6. Follow the on-screen instructions.

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 Workspace home page.

  2. Click Manage Services on the Administration list.

    The Manage Services page appears.

  3. Under Session State, click Manage Preferences.

  4. Click Purge preferences by User.

    The Purge Preferences page appears.

  5. Select a specific user and click Report.

    A report appears at the bottom of the page.

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