Home > Workspace and Application A... > Managing Session State and ... > 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:
To manage user preferences for the current user:
Navigate to the Workspace home page.
Click Manage Services on the Administration list.
The Manage Services page appears.
Under Session State, click Manage Preferences.
On the Manage Preferences page:
To view preference information about the current user, click Report Current User Preferences.
To view and reset preferences for the current user, click Purge Preferences by Current User. On the Purge Preferences page, click the appropriate button.
You view preferences for specific users on the Preferences by User report.
To view the Preferences by User report:
Navigate to the Workspace home page.
Click Manage Services on the Administration list.
The Manage Services page appears.
Under Session State, click Manage Preferences.
Under Session State, click Preferences by user.
The Preferences by Users page appears.
To narrow the results, specify a user, name, or preference type, and click Go.
You can set user preferences within your application through the creation of a page process, by creating a preference item, or programmatically.
Topics:
To set user preference values by creating a page process:
Navigate to the appropriate Page Definition. See "Accessing a Page Definition" in Oracle Application Express Application Builder User's Guide.
Under Processes, click the Create icon.
The Create Page Process Wizard appears.
For the process category, select Session State.
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
Specify a process name, sequence, and processing point.
Specify the preference value in the field provided using the format:
PreferenceName:Item
Click Page Items to see a list of available items.
Click Create Process.
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:
Navigate to the appropriate Page Definition. See "Accessing a Page Definition" in Oracle Application Express Application Builder User's Guide.
Under Items, click the Create icon.
The Create Item Wizard appears.
For the item type, select Hidden.
Specify the Item Name, sequence, and region.
From the Item Source list, select Preference.
In Item Source Value, enter the name of the preference.
Click Create Item.
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
function 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_PREFERENCES
. 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 |
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');
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:
Navigate to the appropriate Page Definition. See "Accessing a Page Definition" in Oracle Application Express Application Builder User's Guide.
Under Processes, click the Create icon.
The Create Page Process Wizard appears.
For the process category, select Session State.
From Type, select Reset Preferences.
Specify a process name, sequence, and process point.
Follow the on-screen instructions.
You can purge preferences for a specific user on the Purge Preferences page.
To purge preferences for a specific user:
Navigate to the Workspace home page.
Click Manage Services on the Administration list.
The Manage Services page appears.
Under Session State, click Manage Preferences.
Under Session State, click Purge preferences by User.
The Purge Preferences page appears.
Select a specific user and click Report.
A report appears at the bottom of the page.
To purge the displayed user preferences, click Purge User Preferences.