Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

drop down list 2

Status
Not open for further replies.

hudo

Programmer
Dec 4, 2003
94
0
0
DE
--WHEN-NEW-FORM-INSTANCE
Code:
DECLARE


group_id RecordGroup;
list_id Item := Find_Item('MYBLOCK.THELIST');
status NUMBER;
rg_name varchar2(40) := 'recgroup';

BEGIN


clear_list(list_id);
group_id := Find_Group(rg_name);
IF NOT id_null(group_id) then
	Delete_Group(group_id);
End if;
group_id := Create_Group_From_Query(rg_name,
'SELECT ENAME FROM EMP');

status := Populate_Group(rg_name);
Populate_List(list_id, group_id);

END;


What is wrong here ?

These errors occur:

FRM-30351: No list elements defined for list item.


FRM-41334: Invalid record group for list population.
 
You need to return 2 columns from your SELECT.
 
Hello,
first of all thanks for your hint.
Maybe you can explain what the second column stands for.

I tested a little bit and found that both columns have to be of TYPE CHAR/VARCHAR2 . For example:

group_id := Create_Group_From_Query(rg_name,
'SELECT TO_CHAR(deptno), Job FROM EMP');

works.

Another related question:

How can it be managed to have already at the start selected one value of the list , for example SCOTT (with QUERY: SELECT ENAME, TO_CHAR(DEPTNO) FROM EMP )
 
Actually each pop-list in Forms is based on 2 columns: meaning and value. If you need them to coinside just select single column twice.

Regards, Dima
 
Hello,
with the following code in a WHEN-NEW-FORM-INSTANCE
Code:
DECLARE

---------LIST -------------
group_id RecordGroup;
list_id Item := Find_Item('CONTROL.THELIST');
status NUMBER;
rg_name varchar2(40) := 'recgroup';

BEGIN
	
----------------------------- LIST 

clear_list(list_id);
group_id := Find_Group(rg_name);
IF NOT id_null(group_id) then
	Delete_Group(group_id);
End if;
group_id := Create_Group_From_Query(rg_name,
'SELECT ENAME ,ENAME FROM EMP');

status := Populate_Group(rg_name);
Populate_List(list_id, group_id);

END;
I can select a entry from scott.emp.ename in the drop down list, it works,
but by starting the form from the form builder appears the "Compilation Errors"
Code:
FRM-30351: No list elements defined for list item.
List THELIST

Created form file D:\oracle\test_904\POPUP.fmx
What is the reason for these compilation errors ?
 
You need to specify a defult item in the 'Elements in list' property of your list item.
 
@lewisp: Thanks it seems to work. It even works if the default item is not part of the latter list. This default item simple does not appear afterwards inn the list.

Another question: Can I populate a list from a table column, e.g. emp.ename AND add a value e.g. "all"
to this list which is not element of the queried table column, but is a valid item of the drop down list ?
 
You could try something like

[tt]group_id := Create_Group_From_Query(rg_name,
'SELECT ENAME ,ENAME FROM EMP UNION SELECT ''All'',''all'' FROM sys.dual'[/tt]

to your list query.

Or you could simply tack it on the end with an Add_List_Element call.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top