neeha
asked on
programatically List Item problem
I have list item and following code at form level 's "When - new - form - instance"
DECLARE
CURSOR C1 IS SELECT distinct remarks FROM stock where remarks is not null;
LV_dname stock.remarks%type;
LN_count NUMBER := 1;
list_id ITEM;
BEGIN
list_id := Find_Item( 'remarks' );
OPEN C1;
LOOP
FETCH C1 INTO LV_Dname;
EXIT WHEN C1%NOTFOUND;
Add_List_Element( list_id, LN_count,
LV_dname, LV_dname);
LN_count := LN_count + 1;
END LOOP;
CLOSE C1;
END;
The code is fine and worked but it creates duplicate rows when I insert more than one record in the same session. I use this with when new record instance and when new item instance but the problem is same that after first record inserted it shows duplicate and then tripplicate and so so records as it picks every time the values from the database and included in the existing records. I want if I put this trigger at 'when new record instance' then it collects data from the database only for newer values not for each and every value.
Suppose there are two values in the remarks.
LOOM
LOOM2
At first time when I loaded the form it shows these two values but when i select one of these and save. The next time( in the same session with out exiting the form) it shows
LOOM
LOOM2
LOOM
LOOM2
I want to eliminate this duplication.
I hope you understand this
DECLARE
CURSOR C1 IS SELECT distinct remarks FROM stock where remarks is not null;
LV_dname stock.remarks%type;
LN_count NUMBER := 1;
list_id ITEM;
BEGIN
list_id := Find_Item( 'remarks' );
OPEN C1;
LOOP
FETCH C1 INTO LV_Dname;
EXIT WHEN C1%NOTFOUND;
Add_List_Element( list_id, LN_count,
LV_dname, LV_dname);
LN_count := LN_count + 1;
END LOOP;
CLOSE C1;
END;
The code is fine and worked but it creates duplicate rows when I insert more than one record in the same session. I use this with when new record instance and when new item instance but the problem is same that after first record inserted it shows duplicate and then tripplicate and so so records as it picks every time the values from the database and included in the existing records. I want if I put this trigger at 'when new record instance' then it collects data from the database only for newer values not for each and every value.
Suppose there are two values in the remarks.
LOOM
LOOM2
At first time when I loaded the form it shows these two values but when i select one of these and save. The next time( in the same session with out exiting the form) it shows
LOOM
LOOM2
LOOM
LOOM2
I want to eliminate this duplication.
I hope you understand this
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I definately forgot the clear_list, I tried several times using clear_item. But millions of thanks for helping me.
Thanks again