Dynamic List Items [message #504098] |
Thu, 21 April 2011 09:48 |
sivaora
Messages: 119 Registered: October 2009 Location: Hyderabad
|
Senior Member |
|
|
Hi All,
I want to create two list items. one is for deptno and another is for empno in a single form.
Based on the selected deptno value from first list item i want to populate corresponding empno from second list item.
I tried with the fallowing code, it's work fine but the second list is not clears with the existing empno's.
Please help me on this...
Code for Deptno List item
declare
cursor c is select deptno from dept;
cnt number := 1;
begin
clear_list('LI_DEPTNO');
for i in c loop
add_list_element('LI_DEPTNO',cnt,i.deptno,i.deptno);
cnt := cnt + 1;
end loop;
end;
Code for Empno list item in when_list_changed trigger for deptno list item
declare
cursor c is select empno from emp where deptno = :LI_DEPTNO;
cnt number := 1;
begin
it_id := Find_Item('LI_EMPNO');
clear_list(it_id);
for i in c loop
add_list_element('LI_EMPNO',cnt,i.empno,i.empno);
cnt := cnt + 1;
end loop;
end;
|
|
|
Re: Dynamic List Items [message #504102 is a reply to message #504098] |
Thu, 21 April 2011 09:58 |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
I'd stop that. Dynamic list items never work properly because:
a) You can't clear a value from a list item if it's in use in any current record in the block.
b) If you try to query a record and the value in the db column that corresponds to the list item isn't recognized by the list item, the form will just not return the record and won't give an idication that it's done so.
Just use text items with LOV's, it'll make your life a whole lot simpler.
|
|
|
|
|