Avatar of ash s
ash s
 asked on

why clear_list not clear the list in oracle form

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;
Oracle Database

Avatar of undefined
Last Comment
Mark Geerlings

8/22/2022 - Mon
Helena Marková

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.
ash s

ASKER
in when_list_changed trigger i used that code....
ash s

ASKER
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.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ash s

ASKER
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
ash s

ASKER
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á

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;
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ash s

ASKER
yp, u understand correctly.............problem is that clear list not clear the 2 list before updating the 2 list depend on list 1.............
ash s

ASKER
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á

I am lost:
1st list - PRC_HT_FURNACE.FURNACE_TYPE - here is When-List-Changed trigger ?
2nd list - PRC_HT_FURNACE.CATEGORY
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ash s

ASKER
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á

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

ASKER
When-list-changed trigger is on PRC_HT_FURNACE.CATEGORY
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ash s

ASKER
sorry When-list-changed trigger is on item- PRC_HT_FURNACE.FURNACE_TYPE
Helena Marková

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 ?
ash s

ASKER
i used When-list-changed trigger on PRC_HT_FURNACE.FURNACE_TYPE but it still not clear the list
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Helena Marková

OK, try only this code

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

ASKER
in which item trigger i used this code?
Helena Marková

Please try it on When-List-Changed trigger on item PRC_HT_FURNACE.FURNACE_TYPE.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ash s

ASKER
if i only use this code then how i populate the list PRC_HT_FURNACE.CATEGORY....................
ASKER CERTIFIED SOLUTION
Helena Marková

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Mark Geerlings

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.