Home » Developer & Programmer » Forms » Can't copy selected records to another block (oracle 10g )
Can't copy selected records to another block [message #546425] Tue, 06 March 2012 12:15 Go to next message
baliberde
Messages: 201
Registered: January 2012
Location: outer space
Senior Member
Hi everyone, I have 2 blocks, namely addsubject3rd and chosensubjects. I'm copying the selected records(this comes with checkboxes) from the 1st block to the second block. But what happened is that it copied all the records that are on the addsubject3rd. How can I copy only selected records(checkboxes) from addsubject3rd block to chosensubjects blocks?
Re: Can't copy selected records to another block [message #546453 is a reply to message #546425] Tue, 06 March 2012 15:09 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
By fixing malfunctioning code you've written.
Re: Can't copy selected records to another block [message #546458 is a reply to message #546453] Tue, 06 March 2012 15:26 Go to previous messageGo to next message
baliberde
Messages: 201
Registered: January 2012
Location: outer space
Senior Member
My code here:

 go_block('ADDSUBJECT3RD');
  first_record;
        GO_BLOCK('CHOSENSUBJECTS');
  first_record;

  LOOP

IF :ADDSUBJECT3RD.SELECTED3RD = 'Y' THEN
  
    :CHOSENSUBJECTS.Subj := :ADDSUBJECT3RD.subj_code3rd;
    :CHOSENSUBJECTS.STIME := :ADDSUBJECT3rd.stime;
    :CHOSENSUBJECTS.ETIME := :ADDSUBJECT3RD.ETIME;
    :CHOSENSUBJECTS.DAY := :ADDSUBJECT3RD.DAY3RD;
    :CHOSENSUBJECTS.SECTION := :ADDSUBJECT3RD.SECTION3RD;

END IF;  


    go_block('ADDSUBJECT3RD');
    IF :system.last_record != 'TRUE' THEN
      --More records to go so move to the next record in both blocks.
      next_record;
      go_block('CHOSENSUBJECTS');
      next_record;
    ELSE
      --Done all records, exit loop
      EXIT;
      
    END IF;
    
    END LOOP;
    
    
      GO_BLOCK('CHOSENSUBJECTS');
 first_record;
END;


but it's just keep executing the whole records not those selected ones by my checkbox

[Updated on: Tue, 06 March 2012 15:39]

Report message to a moderator

Re: Can't copy selected records to another block [message #546459 is a reply to message #546458] Tue, 06 March 2012 15:47 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Cookiemonster spent days to teach you how to debug your code, but you learnt nothing. Does MESSAGE ring a bell? If you can't do that, take a piece of paper, draw these blocks, put some values in there, and manually follow the code you've written, line by line. Write every change onto a paper. If you are careful and patient enough, you'll find a culprit. Hint: where does cursor go after GO_BLOCK is executed?

Just being curious: what is "Oracle 10g" in a topic title? Database version? Forms version? Both?
Re: Can't copy selected records to another block [message #546461 is a reply to message #546459] Tue, 06 March 2012 16:08 Go to previous messageGo to next message
owais_baba
Messages: 289
Registered: March 2008
Location: MUSCAT
Senior Member
Mr baliberde once again gonna tell u its not an issue what ever is your topic its quite easy pls concentrate what ever cokiemonster is saying just see how this code is working

------very simple example--for---u----
GO_BLOCK('B');
           clear_block(no_commit);
     declare 
     	  cursor c1 is
     	          select * from a WHERE NO=:A.NO ;
                a_record c1%rowtype;
     begin
           open c1;
     loop
           
           fetch c1 into a_record;
                 exit when c1%notfound;
   IF :A.CHK='Y' THEN 
               :b.no:=a_record.no;
               :b.name:=a_record.name;
     next_record;
     ELSE -----its upto---You
   -----what ever u wanna do-----------------
   
      	MESSAGE('YOUR CHECK BOX IS UN-CHECKED');
       	MESSAGE('YOUR CHECK BOX IS UN-CHECKED');
   GO_BLOCK('A');
     
    END IF;
    
        end loop;
            close c1;
        
    end;
         first_Record;


hope this time u will learn from cookiemonster and littlefoot they are a good teachers believe me


best regards


[Updated on: Tue, 06 March 2012 16:14]

Report message to a moderator

Re: Can't copy selected records to another block [message #546463 is a reply to message #546461] Tue, 06 March 2012 16:21 Go to previous message
owais_baba
Messages: 289
Registered: March 2008
Location: MUSCAT
Senior Member
Let me create tables also otherwise u would not understand

create table a(no number(6));

insert into a values(1001);

create table b(no number(6),name varchar2(25));

insert into b values(1001,'baliberde');



Now run the Form
Previous Topic: Data Block ignoring the order by clause
Next Topic: FRM-47023
Goto Forum:
  


Current Time: Sat Jul 06 00:07:58 CDT 2024