« Griot's Spray-On Protective Bra | Main | Z4 M CoupĂ© Strut Brace »
July 13, 2006
Getting and Setting Sort Preferences
Q:For reports that have clickable column headers, HTML DB remembers this sorting choice by establishing a preference named FSP
A:It is possible to find the region_id using htmldb_application.g_plug_id (plugs are regions) via g_plug_name
This code will show the approach:
begin
htp.tableOpen;
htp.tableRowOpen;
htp.tableHeader('region_id');
htp.tableHeader('region_name');
htp.tableRowClose;
for i in 1.. htmldb_application.g_plug_id.COUNT loop
htp.tableRowOpen;
htp.tableData(htmldb_application.g_plug_id(i));
htp.tableData(htmldb_application.g_plug_name(i));
htp.tableRowClose;
end loop;
htp.tableClose;
end;
Here is the full solution:
Before Header Process: Set region sort preference
declare
l_region_id varchar2(20);
begin
-- find the ID of the region
for i in 1.. htmldb_application.g_plug_id.COUNT loop
if htmldb_application.g_plug_name(i) = :P1_REGION_NAME then
l_region_id := htmldb_application.g_plug_id(i);
end if;
end loop;
:P1_REGION_FSP_SORT := 'FSP' || :APP_ID || '_P' || :APP_PAGE_ID || '_R' || l_region_id || '_SORT';
end;
On Submit Process: Reset Sort Change
HTMLDB_UTIL.SET_PREFERENCE( p_preference => :P1_REGION_FSP_SORT , p_value => :P1_FSP_DEFAULT_SORT_COLUMN);
Item: P1_FSP_DEFAULT_SORT_COLUMN is set to the column value I want to reset to, ie. fsp_sort_1_desc
Posted by rimblas at July 13, 2006 9:57 AM