dynamic population of data in a combo box. [message #77426] |
Mon, 31 March 2003 22:15 |
needAsolution
Messages: 3 Registered: March 2003
|
Junior Member |
|
|
I am using oracle PDK technology and writing html pages using PL/SQL procedures.
My problem is to have a dynamic population of data in a combo box.
For example :
I have a combo box(say, Parent) which gets data from DB and display the data for selection.
I have another combo box(say, Child) which also should gets data from DB but, depending upon the above combo box selections.
Like, if we take employee table and Dept table. If parent combo box is the list of dept codes then child combo box should be list of employee names/ids in that particular dept.
Developing Environment
-------------------------
Oracle 9iAS, Oracle 8i(pl/sql)
PDK. Solaris OS.
|
|
|
Re: dynamic population of data in a combo box. [message #77427 is a reply to message #77426] |
Fri, 11 April 2003 12:03 |
Bachir A
Messages: 1 Registered: April 2003
|
Junior Member |
|
|
Hi,
Let's say that your first combobox is CBX_Parent and your second combobox is CBX_Child.
The code to populate your Parent combobox:
Declare
v_rg_id_Parent recordgroup;
v_n_Parent number;
Parent_Query Varchar2(1000);
BEGIN
Parent_Query := ' select dname, to_char(dept_no) from dept';
v_rg_id_Parent := create_group_from_query('RG_PARENT', Parent_Query);
v_n_Parent := populate_group('RG_PARENT');
clear_list('CBX_Parent');
populate_list ('CBX_Parent','RG_PARENT');
DELETE_GROUP(v_rg_id_Parent);
END;
The code to populate your Child combobox:
Declare
v_rg_id_Child recordgroup;
v_n_Child number;
Child_Query Varchar2(1000);
BEGIN
Child_Query := 'select ename, to_char(empno) from emp where deptno = :CBX_Parent';
v_rg_id_Child := create_group_from_query('RG_CHILD' , Child_Query);
Child_Query := populate_group('RG_CHILD');
clear_list('CBX_Child');
populate_list ('CBX_Child', 'RG_CHILD');
DELETE_GROUP(v_rg_id_Child);
END;
I hope that's help you
Bachir A
|
|
|
|