1.10 Managing User Preferences

Developers 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. Administrators 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.

1.10.1 Setting User Preferences

Workspace administrators can set user preferences within an application by creating a page process, creating a preference item, or programmatically using a PL/SQL API.

1.10.1.1 Setting User Preferences by Creating a Page Process

Developers can set user preference values by creating a page process.

To set user preference values by creating a page process:

  1. View the page in Page Designer and click the Processing tab.
  2. Under Processes, right-click and select Create Process.
    Process attributes display in the Property Editor.
  3. Under Identification:
    1. Name - Enter the name of the process.
    1. Type - Select User Preferences.
  4. Under Settings, Type - Select Reset Preferences (remove all preferences for current user).
  5. Under Execution Options:
    1. Sequence - Specify the sequence for this component. The sequence determines the order of execution.
    2. Point - Select the point at which the process executes.
  6. Review and complete any additional attributes.

    Tip:

    To learn more about an attribute, select the attribute in the Property Editor and click the Help tab in the center pane.

  7. Click Save.

See Also:

"Creating Page Processes in Page Designer" in Oracle Application Express App Builder User’s Guide

1.10.1.2 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. View the page in Page Designer.
  2. Click the Rendering tab.
  3. Locate the region to contain the item, right-click and select Create Page Item.
    Item attributes display in the Property Editor.

    Note:

    To learn more about an attribute, select the attribute and click the Help tab in the central pane.

  4. Under Identification:
    1. Name - Enter a name of the item.
    1. Type - Select Hidden.
  5. Under Settings, Value Protected - Specify whether the item is protected, preventing the value from being manipulated when the page is posted. Select Yes.
  6. Under Layout:
    1. Sequence - Enter the display sequence for this item. The sequence and other layout settings determine where this item is displayed in relation to other items within the region..
    1. Region - Select the region in which the item displays. All items should be specified in a region.
  7. Under Source:
    1. Type - Select the source type the value of this item is based on.
    2. Used - Select which value takes precedence (that is, the value from session state or the item source value).
  8. Under Default, Type - Select a default value type for this item..
  9. Click Save.

1.10.1.3 Setting User Preferences Programmatically

You can set or reference user preferences programmatically using 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 API Reference

1.10.2 Viewing Preferences by User

View user preferences by user on the Preferences by User page.

To view the preferences by user:

  1. Navigate to the Workspace Administration page:
    1. Sign in to Oracle Application Express.
    2. At the top of the Workspace home page, click the Administration menu and select Administration.

    The Workspace Administration home page appears.

  2. On the Administration page, click Manage Service.
  3. Under Manage Meta Data, click Session State.
  4. Click Preferences by User.

    The Preferences by User page appears.

  5. You can customize the appearance of the page using the Search bar at the top of the page.

1.10.3 Viewing Current User Preferences

View current user preferences.

To view current user preferences:

  1. Navigate to the Workspace Administration page:
    1. Sign in to Oracle Application Express.
    2. At the top of the Workspace home page, click the Administration menu and select Administration.

    The Workspace Administration home page appears.

  2. On the Administration page, click Manage Service.
  3. Under Manage Meta Data, click Session State.
  4. Click Current User Preferences.

    The Current user Preferences page appears.

    You can customize the appearance of the page using the Search bar at the top of the page.

1.10.4 Purging Preferences for a Specific User

Purge preferences for a specific user on the Purge Preferences page.

To purge preferences for a specific user:

  1. Navigate to the Workspace Administration page:
    1. Sign in to Oracle Application Express.
    2. At the top of the Workspace home page, click the Administration menu and select Administration.

    The Workspace Administration home page appears.

  2. On the Administration page, click Manage Service.
  3. Under Manage Meta Data, click Session State.
  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.

1.10.5 Purging Preferences for the Current User

Purge preferences for the current user on the Current User Preferences page.

To purge preferences for the current user:

  1. Navigate to the Workspace Administration page:
    1. Sign in to Oracle Application Express.
    2. At the top of the Workspace home page, click the Administration menu and select Administration.

    The Workspace Administration home page appears.

  2. On the Administration page, click Manage Service.
  3. Under Manage Meta Data, click Session State.
  4. Click Purge Preferences for Current User.
  5. Click View Preferences or Reset Preferences.
  6. If you select View Preferences, the Current User Preferences page appears. To reset the user preferences, click Reset.

1.10.6 Removing User Preferences Programmatically

Remove user preferences programmatically using a PL/SQL API.

To remove user preferences programmatically, use the REMOVE_PREFERENCE procedure to remove a user level preference called NAMED_PREFERENCE. For example:

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

See Also:

"REMOVE_PREFERENCE" in Oracle Application Express API Reference

1.10.7 Resetting User Preferences Using a Page Process

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

To reset user preferences using a page process:

  1. View the page in Page Designer and click the Processing tab.
  2. Under Processes, right-click and select Create Process.
    Process attributes display in the Property Editor.

    Tip:

    To learn more about an attribute, select the attribute in the Property Editor and click the Help tab in the center pane.

  3. Under Identification:
    1. Name - Enter the name of the process.
    1. Type - Select Clear Session State.
  4. Under Settings, Type - Select Clear Session State.
  5. Under Execution Options:
    1. Sequence - Specify the sequence for this component. The sequence determines the order of execution.
    2. Point - Select the point at which the process executes.
    3. Run Process - Select the frequency that this process is executed.
  6. Review and complete any additional attributes.
  7. Click Save.

See Also:

"Creating Page Processes in Page Designer" in Oracle Application Express App Builder User’s Guide