Managing User Preferences

Previous
Previous
Next
Next

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

Topics:

Viewing and Resetting Preferences for the Current User

To manage user preferences for the current user:

  1. On the Database Home Page, click the Application Builder icon.

  2. From the Administration list, select Manage Services.

  3. Click Session State.

  4. When the Session State page appears, click Current preferences and session state with an option to purge.

  5. To view preferences for the current user, click View Preferences.

  6. To reset user preferences for the current user, click Reset Preferences.

Viewing Preferences for Users

You view preferences for a specific user on the Purge Preferences report.

To view the Purge Preferences report:

  1. On the Database Home Page, click the Application Builder icon.

  2. From the Administration list, select Manage Services.

  3. Click Session State.

  4. On the Session State page, select Preferences by user.

    The Preferences by Users page appears.

  5. Specify a user and click Go.

Setting User Preferences

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

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:

    1. Navigate to the Database Home Page.

    2. Click the Application Builder icon.

    3. Select an application.

    4. Select a page.

      The Page Definition appears.

  2. Under Page 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. Follow the on-screen instructions.

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:

    1. Navigate to the Database Home Page.

    2. Click the Application Builder icon.

    3. Select an application.

    4. Select a page.

      The Page Definition appears.

  2. Under Item, 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 Programatically

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

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

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

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

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

Removing User Preferences Programatically

To remove user preferences programatically, 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:

HTMLDB_UTIL.REMOVE_PREFERENCE(
p_preference=>'NAMED_PREFERENCE',
p_value =>:ITEM_NAME);

Resetting User Preferences Using a Page Process

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

To reset user preferences using a page process:

  1. Navigate to the appropriate Page Definition:

    1. Navigate to the Database Home Page.

    2. Click the Application Builder icon.

    3. Select an application.

    4. Select a page.

      The Page Definition appears.

  2. Under Page 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. On the Database Home Page, click the Application Builder icon.

  2. From the Administration list, select Manage Services.

  3. Click Session State.

  4. On the Session State page, select 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.