Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » Correct Use of LOV (OracleAPEX, 18.5, Linux)
Correct Use of LOV [message #675479] Tue, 02 April 2019 04:06 Go to next message
drosso
Messages: 2
Registered: April 2019
Junior Member
Hi,
I'm new to APEX and I'm trying to understand the correct usage of a LOV Item; in my use cases I often have fields that are made of a code and a description: the description is shown on the form whilst the code remains beneath the scene and must be used when the record is saved to DB.
At the moment, for all these fields I'm using LOV items, where the description is the display value and the code the return value: I thought that referencing the item when saving to DB would allow me to access the code (i.e. the return value of the LOV) but it seems that the description (i.e. the display value) is always given.
Am I doing something wrong ? Should I use a different kind of item in this case ?
Thank you.
Re: Correct Use of LOV [message #675495 is a reply to message #675479] Tue, 02 April 2019 07:29 Go to previous messageGo to next message
cookiemonster
Messages: 13747
Registered: September 2008
Location: Rainy Manchester
Senior Member
I don't use apex but I have done lots of forms coding and forms LOVs sound the same.
To do this in forms you would need two items - an invisible one for the code that is linked to the DB column and a visible one for the description that's not linked to the DB.

If the LOV only returned the code then surely the code is what you would see in the form?
Re: Correct Use of LOV [message #675508 is a reply to message #675495] Tue, 02 April 2019 14:13 Go to previous messageGo to next message
Littlefoot
Messages: 21514
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Cookiemonster, in Apex, LoV query always has to have two values: a display (such as ENAME) and return (such as EMPNO) values. No more, no less. Display value is displayed on the screen (when you select from a LoV), return value is saved into the database (and isn't visible on the screen *). For example:

select ename d,       --> display value
       empno r        --> return value
from emp
where deptno = :P1_DEPTNO    --> referencing a page item

* Return value can be visible, of course, if you concatenate it with a display value, e.g.
select empno ||' - '|| ename d,
       empno r
from ...




As of the question itself: return value *is* what you can reference, so - what you (drosso) are saying doesn't make sense to me. Could you explain it better? Post a screenshot? If possible, create an example on apex.oracle.com, let us know the credentials so that someone could have a look and see.
Re: Correct Use of LOV [message #675515 is a reply to message #675508] Wed, 03 April 2019 03:45 Go to previous messageGo to next message
drosso
Messages: 2
Registered: April 2019
Junior Member
Littlefoot wrote on Tue, 02 April 2019 14:13
Cookiemonster, in Apex, LoV query always has to have two values: a display (such as ENAME) and return (such as EMPNO) values. No more, no less. Display value is displayed on the screen (when you select from a LoV), return value is saved into the database (and isn't visible on the screen *). For example:

select ename d,       --> display value
       empno r        --> return value
from emp
where deptno = :P1_DEPTNO    --> referencing a page item

* Return value can be visible, of course, if you concatenate it with a display value, e.g.
select empno ||' - '|| ename d,
       empno r
from ...




As of the question itself: return value *is* what you can reference, so - what you (drosso) are saying doesn't make sense to me. Could you explain it better? Post a screenshot? If possible, create an example on apex.oracle.com, let us know the credentials so that someone could have a look and see.
Thank you Littlefoot, I checked once more the form and I found out that I was referencing the wrong items; LOVs work exactly as you explained, and I finally managed to use a LOV as I expected it to work.
Re: Correct Use of LOV [message #675532 is a reply to message #675515] Wed, 03 April 2019 15:33 Go to previous message
Littlefoot
Messages: 21514
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You're welcome; I'm glad if you made it work.
Previous Topic: Apex
Next Topic: Error message in PL/SQL package to APEX page
Goto Forum:
  


Current Time: Fri Dec 06 07:11:48 CST 2019