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 ?
-
2What does "direction" mean in this context? I've never heard of that. – Littlefoot Mar 03 '20 at 09:56
2 Answers
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

- 32
- 4
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.

- 59,113
- 10
- 31
- 55
-
Why KEY-CLRBLK? Seems to me like KEY-LISTVAL on the text field ("tf1" in your example) would be the better option. – AndyDan Mar 04 '20 at 15:11
-
yes, might be, but I would prefer pressing on a single key(`F7`) rather than combination (`Ctrl+L`) @AndyDan . – Barbaros Özhan Mar 04 '20 at 15:26
-
Maybe your key mapping needs to be updated. For us, key-listval is F9. And using a key for purpose other than it's intended requires the user to know that, in this particular case, they need to use a different key to get the LOV than they usually do. – AndyDan Mar 04 '20 at 15:48