Application Express User's Guide > Understanding Application A... > Managing Session State and ... > Managing User Preferences
Managing User Preferences |
Previous |
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:
To manage user preferences for the current user:
On the Database Home Page, click the Application Builder icon.
From the Administration list, select Manage Services.
Click Session State.
When the Session State page appears, click Current preferences and session state with an option to purge.
To view preferences for the current user, click View Preferences.
To reset user preferences for the current user, click Reset Preferences.
You view preferences for a specific user on the Purge Preferences report.
To view the Purge Preferences report:
On the Database Home Page, click the Application Builder icon.
From the Administration list, select Manage Services.
Click Session State.
On the Session State page, select Preferences by user.
The Preferences by Users page appears.
Specify a user and click Go.
You can set user preferences within your application through the creation of a page process, by creating a preference item, or programatically.
Topics:
To set user preference values by creating a page process:
Navigate to the appropriate Page Definition:
Navigate to the Database Home Page.
Click the Application Builder icon.
Select an application.
Select a page.
The Page Definition appears.
Under Page 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.
Follow the on-screen instructions.
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:
Navigate to the Database Home Page.
Click the Application Builder icon.
Select an application.
Select a page.
The Page Definition appears.
Under Item, 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 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.
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);
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:
Navigate to the appropriate Page Definition:
Navigate to the Database Home Page.
Click the Application Builder icon.
Select an application.
Select a page.
The Page Definition appears.
Under Page 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:
On the Database Home Page, click the Application Builder icon.
From the Administration list, select Manage Services.
Click Session State.
On the Session State page, select 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.