Home » Developer & Programmer » Forms » dynamic lov
dynamic lov [message #164092] Tue, 21 March 2006 16:07 Go to next message
doc1
Messages: 18
Registered: December 2005
Junior Member
hi!

I am trying to populate values in lov dynamically.. i have writen code in trigger when-new-record-instance n has attache lov to the item in the block(block manipulate multiple records at same time)..now the problem is wen i entered into new record n click the item instead of appreaing the lov it prompts record must be delted or inserted first and it keeps promting that..can anyone fix this or atleast tell me where is the problem in the code below

DECLARE
   all_grp      recordgroup;
   status       NUMBER (3);
   fm_id        formmodule;
   rec_num      NUMBER (3);
   lst_rec      NUMBER (3);
   row_count    NUMBER (3);
   group_rec    NUMBER;
   cur_all_id   VARCHAR2 (15);
BEGIN
   all_grp  := Find_group ('all_lov');
   status   := Populate_group (all_grp);

   IF status = 0 THEN
      fm_id    := Find_form (:system.current_form);
      Set_form_property (fm_id, validation, property_false);
      Go_block ('pvt_all');
      rec_num  := To_number (:system.cursor_record);
      lst_rec  := To_number (:system.cursor_record);
      first_record;

      FOR row_count IN 1 .. lst_rec
      LOOP
         cur_all_id  := :pvt_all.all_id;
         group_rec   := Get_group_record_number ('all_lov.all_id', cur_all_id);

         IF group_rec > 0 THEN
            Delete_group_row (all_grp, group_rec);
         END IF;

         next_record;
      END LOOP;

      Go_record (rec_num);
   END IF;

   Set_form_property (fm_id, validation, property_true);
END;

Upd-mod: Next time please format your code so that it is readable! Try http://www.orafaq.com/cgi-bin/sqlformat/pp/utilities/sqlformatter.tpl

[Updated on: Wed, 22 March 2006 00:44] by Moderator

Report message to a moderator

Re: dynamic lov [message #164152 is a reply to message #164092] Wed, 22 March 2006 00:45 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
1) Why are you wasting your time with this? The regular LOV with a regular record_group is sufficient.
2) You have a go_block. Why? You are already in your block. Take it out and it may work.

David
Re: dynamic lov [message #164265 is a reply to message #164092] Wed, 22 March 2006 12:41 Go to previous messageGo to next message
doc1
Messages: 18
Registered: December 2005
Junior Member
1. the block is based on table pvt_all(p_id,all_id,all_catgory). now against one p_id there can be multiple all_id but should be unique. Now block can retreive or perform dml at multiple records at same time. so, if user accidently enters all_id into a record that has already been entered into any previous record, data will not be committed on save. so all i am trying to do is to remove those values from lov at run time which has already been entered against that particular p_id.

2. it is not working even after removing go_block statement
Re: dynamic lov [message #164534 is a reply to message #164265] Thu, 23 March 2006 22:10 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
I think you need to delete the group and repopulate it on each line. Have a look at http://www.orafaq.com/forum/m/153655/67467/?srch=delete_group#msg_153655

David
Previous Topic: Executing a query from a menu or button..?
Next Topic: urgent help on text_io package
Goto Forum:
  


Current Time: Fri Sep 20 07:43:11 CDT 2024