why clear_list not clear the  list in oracle form

ash s
ash s used Ask the Experts™
on
here is my sample code.....please check what is wrong in this code why clear_list not clear the list before updating the list for second selection from drop-down....

DECLARE

   CURSOR CUR_FURNACE_CAT_TYPE(F_TYPE IN CHAR) IS
   
   SELECT FURNACE_TYPE,CAT_TYPE_DESC,CAT_TYPE_ID
   from PRC_FURNACE_CAT_TYPE
   WHERE FURNACE_TYPE=F_TYPE
   order by  CAT_TYPE_ID;
   
   V_CNT NUMBER := 1;

BEGIN
    CLEAR_LIST('PRC_HT_FURNACE.CATEGORY');

       IF :PRC_HT_FURNACE.FURNACE_TYPE='04' THEN  
     
              FOR LP IN CUR_FURNACE_CAT_TYPE('04') LOOP    
                    
                                  ADD_LIST_ELEMENT('PRC_HT_FURNACE.CATEGORY', V_CNT, LP.CAT_TYPE_DESC,LP.CAT_TYPE_ID);
                                  V_CNT := V_CNT + 1;
                                 
              END LOOP;
     
       ELSIF :PRC_HT_FURNACE.FURNACE_TYPE='05'  THEN  
                                               
              FOR LP IN CUR_FURNACE_CAT_TYPE('05') LOOP          
                    
                                  ADD_LIST_ELEMENT('PRC_HT_FURNACE.CATEGORY', V_CNT, LP.CAT_TYPE_DESC,LP.CAT_TYPE_ID);
                                  V_CNT := V_CNT + 1;
                                  
              END LOOP;
           
        ELSIF :PRC_HT_FURNACE.FURNACE_TYPE='06'  THEN  
                                               
              FOR LP IN CUR_FURNACE_CAT_TYPE('06') LOOP
                    
                                  ADD_LIST_ELEMENT('PRC_HT_FURNACE.CATEGORY', V_CNT, LP.CAT_TYPE_DESC,LP.CAT_TYPE_ID);
                                  V_CNT := V_CNT + 1;
                                  
          END LOOP;                                    
        END IF;

 END;
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Helena Markováprogrammer-analyst

Commented:
Where (in what trigger) is the provided code used ?  Also you have to read Clear_list built-in in the Forms on-line help for usage notes and restriction.

Author

Commented:
in when_list_changed trigger i used that code....

Author

Commented:
that is Drop down list 2 which depends on the value that it is selected in Drop down list 1

somehow on list changed of Drop down list 1 i want the Drop down list 2 to be filtered.

i write drop down list 1 code in when new form instance......and drop down list 2 code in when_list_changed trigger.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
supposed i have 1st list the
A
B
C

if i select 'A'

then Second list show
 1
2
3
and if i select B in 1 drop-down list
then 2nd list show
3
4
5

Author

Commented:
but in my code problem is that when i select A then it show result
1
2
 3
and when i select B then it show
3
4
5
1
2
3
clear_list not clear the list.
Helena Markováprogrammer-analyst

Commented:
If I understand it correctly there is 1st list - PRC_HT_FURNACE.FURNACE_TYPE and second PRC_HT_FURNACE.CATEGORY. Is there any error ?
Have you try only this code ?

 BEGIN
     CLEAR_LIST('PRC_HT_FURNACE.CATEGORY');
END;

Author

Commented:
yp, u understand correctly.............problem is that clear list not clear the 2 list before updating the 2 list depend on list 1.............

Author

Commented:
i write whole above code(2nd drop down list code) in when_list_changed trigger and 1st drop down list code in when-new-form-instance......
Helena Markováprogrammer-analyst

Commented:
I am lost:
1st list - PRC_HT_FURNACE.FURNACE_TYPE - here is When-List-Changed trigger ?
2nd list - PRC_HT_FURNACE.CATEGORY

Author

Commented:
no............
1st list - PRC_HT_FURNACE.FURNACE_TYPE -------------------code in when_new_form_instance
2nd list - PRC_HT_FURNACE.CATEGORY--------code in When-List-Changed trigger
Helena Markováprogrammer-analyst

Commented:
But When-list-changed trigger is on what item- PRC_HT_FURNACE.FURNACE_TYPE or PRC_HT_FURNACE.CATEGORY ?

Author

Commented:
When-list-changed trigger is on PRC_HT_FURNACE.CATEGORY

Author

Commented:
sorry When-list-changed trigger is on item- PRC_HT_FURNACE.FURNACE_TYPE
Helena Markováprogrammer-analyst

Commented:
So it is the problem, because you cannot clear list item in its when-list-changed trigger.  You can use your code e.g. in When-New-Record-Instance trigger of block PRC_HT_FURNACE and also in When-list-changed trigger on PRC_HT_FURNACE.FURNACE_TYPE.

According to your last post it ought to work. Have you try only clear_list and see what will happen ?

Author

Commented:
i used When-list-changed trigger on PRC_HT_FURNACE.FURNACE_TYPE but it still not clear the list
Helena Markováprogrammer-analyst

Commented:
OK, try only this code

BEGIN
    CLEAR_LIST('PRC_HT_FURNACE.CATEGORY');
END;

Author

Commented:
in which item trigger i used this code?
Helena Markováprogrammer-analyst

Commented:
Please try it on When-List-Changed trigger on item PRC_HT_FURNACE.FURNACE_TYPE.

Author

Commented:
if i only use this code then how i populate the list PRC_HT_FURNACE.CATEGORY....................
programmer-analyst
Commented:
For this test you can use this part of your code in the When-New-Form-Instance trigger:
 FOR LP IN CUR_FURNACE_CAT_TYPE('04') LOOP    
                     
                                   ADD_LIST_ELEMENT('PRC_HT_FURNACE.CATEGORY', V_CNT, LP.CAT_TYPE_DESC,LP.CAT_TYPE_ID);
                                   V_CNT := V_CNT + 1;
                                   
               END LOOP;
Mark GeerlingsDatabase Administrator
Commented:
Have you considered using plain text items with LOVs instead of "list" items in Oracle Forms.  I find these easier to work with as a developer than list items, and more flexible for users (especially for querying).  But maybe you consider this combination to be "old fashioned" and "list items" to be more up-to-date or "user-friendly".  It is true that plain text items and LOVs have been supported in Oracle Forms for at least 30 years, and "list" items have only been supported for about 25 years.
 items

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial