Reputation: 21
how can I change direction of LOV using set_item_property ? I want to change the direction based on a parameter value , if set_item_property is not available do you have any suggestions ?
Upvotes: 1
Views: 2803
Reputation: 65218
If you mean ordering of the listed values in ascending or descending manner by the word direction, you can manage it through use of Set_Lov_Property.
You should be calling the existing LOV
from a text field(call tf1
).
Add a check box item (call cb1
) next to tf1
.
Forms creates a Record Group
as LOV
being created with the same name as default(call 'mylov01'
). Assume this Record Group
has a select statement having order by col0 asc
clause.
Manually create an extra Record Group
with name mylov01_desc
having order by col0 desc
clause.
Add a KEY-CLRBLK
trigger to that field with the code
declare
v_lov varchar2(50) := 'mylov01';
v_grn varchar2(50);
begin
if Checkbox_Checked('cb1') then
v_grn := v_lov||'_desc';
else
v_grn := v_lov;
end if;
Set_Lov_Property( v_lov, group_name, v_grn );
list_values;
end;
Invoke the LOV
by pressing F7
whenever the cursor is in tf1
.
The list would return rows in descending order for col0
column provided that cb1
is checked, otherwise would be in ascending order.
P.S. KEY-LISTVAL
is the default trigger to invoke a LOV, and fired through Ctrl+L
key combination. I prefer disabling this default behaviour by adding KEY-LISTVAL
trigger for tf1
with a code null;
in it in order to invoke the LOV from pressing the single key F7
only.
Upvotes: 0
Reputation: 32
use an 'ORDER BY' clause at the end of the query. using either ASC for ascending data 'ABCD' or DESC for descending order 'ZYX' e.g.
SELECT *
FROM table
ORDER BY parameter ASC
OR
SELECT *
FROM table
ORDER BY parameter DESC
Upvotes: 0