Main Region

How to populate grid combo boxes and how to read from them? VARCHAR2 versus NUMBER types
2 answers | 487 views

Jul 29, 2013 14:27 +00:00

I have a general question in dealing with LOV-items like (grid) combo boxes, popup lovs etc.

When populating these items I deliver (set) the string value and not the primary key value (id) which is numeric of cause. This I figured I have to do in order to display the proper text and not the surrogate key.

So when using the grid combo box I do the same. Input is provided by text - Output (saving) ist done with the numeric id. This works fine, when I do some selection activity with the grid combo box (which - by the way - is really cool). If I do nothing (no selection - save the origin value) I get an "PL/SQL: numeric or value error: character to number conversion error"

I set the "Item Return Value - Which Grid Column?(Value Required)" in the grid combo box to the ID, respectively.

  1. Question: am I in general wrong in populating the LOVs with the text values and reading the IDs?

  2. Question: is there something different with the grid combo box?

regards Jochen

1 comment

Matt Nolan Jul 29, 2013 17:32 +00:00 

The editable grid popup lov issue is a bug that has been previously reported and will be fixed in the forthcoming v1.1.3 release.

I will run some tests on the grid combo, if I can't reproduce I will need you to create a test case.

Jul 29, 2013 14:59 +00:00

To answer your questions (if I understand the Question correctly):

1) Yes. You must always set the item's value using the return value column of the LOV for all combo items, grid combo included. Setting the items using the Text value is not supported (plus there shouldn't be any need to). If you encounter any display issues when using the return value and the return/ID value is showing instead of the display value please provide a test case for us to investigate and file a bug.

2) That's hard to say other than that it is a different plugin and code base :) The grid plugin is based on a display/return value setting where the return value is the actual database value sourced from your table. The display value is sourced from the LOV query and will be displayed correctly when a valid ID from your LOV query is found. If you set the grid to a value which does not exist (based on the ID) it will be shown in raw format in this case your return value is the same as the display value and is the reason for the PLSQL exception. To re-iterate the above you must always use the ID/Return Value (or corressponding data type) from the LOV query when setting combo values.


Jul 29, 2013 15:21 +00:00

I understood the lov-Items also in the way that you have a key/value pair like

"select text, id from lov"

But when I provide the id in Popup LOVs and in the grid combo box, the numeric ID is displayed to the user an not the text value.

This is true with popup lovs in the editable grid and I experienced the same with the grid combo. I think in "pure APEX" it worked the proper way, always providing the key values (id) an not the text values.

How can I prevent the LOVs from showing the id? (I always set "Display Extra Values" to NO)

Generally: I read always from views or Object types and I always write back the data via PL/SQL-procedures or Object types. I never read from the table or write back to the table directly - but this has nothing to do with my "display problem"


You must log in or sign up to post questions and answers.