Re: How to loop through records in a data block?
Date: 25 Apr 99 00:53:37 GMT
Message-ID: <37226791.0_at_ecn.ab.ca>
[Quoted] Thank you very very much for all of your help. May I redefine the problem I have, please?
I want to list out all rentals records for a customer. I put four data blocks: Customers, Rentals, Tapes, and Movies. I also build a canvas as follow. Basically, the tape_id and movie_id is one-to-one relationship.
Rentals data block Tapes Movies data block
+-------------------+ +----------------+ +-----------------------+ |Tape_id, Rent_date | |Tape_id,Movie_id| |Movie_id, Title, Status| | | | | | | | | | | | | | | | | | | | | | | | | +-------------------+ +----------------+ +-----------------------+
To populate the data for the Movies block, I created a trigger ON-POPULATE-DETAILS in the Rentals block. However, I received the message 'Do you want to save the change you have made?' when the statement 'GO_BLOCK('RENTALS')' was executed. If I answered 'Yes', it complained that 'Unable to insert record'. Then, it listed the corresponding movies records in the Movies block. But if I answered 'No' or 'Cancel', it went for an infinitive loop.
Please help.
IF ( (:RENTALS.TAPE_ID is not null) ) THEN
FIRST_RECORD;
LOOP
GO_BLOCK ('MOVIES'); FOR cur_movies IN cur_movies_rec LOOP :movies.id := cur_movies.id; :movies.title := cur_movies.title; :movies.status := cur_movies.status; NEXT_RECORD; END LOOP; GO_BLOCK ('RENTALS'); <------ Problem here!!!! EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE'; NEXT_RECORD;
END LOOP;
FIRST_RECORD;
END IF; Steve Cosner (stevec_at_zimmer.csufresno.edu) wrote:
: In article <37212bdb.0_at_ecn.ab.ca>, <suisum_at_ecn.ab.ca> wrote:
: >I need to loop through all records in a data block. What is the condition
: >for the WHILE loop, please?
: >
: >I have tried WHILE :SYSTEM.LAST_RECORD = 'FALSE' LOOP
: >or WHILE :data_block.item IS NOT NULL LOOP
: Go_Block('Your_Block');
: First_Record;
: IF :System.Record_Status<>'NEW' then
: Loop
: -- do something here --
: Exit when :system.last_record = 'TRUE';
: Next_Record;
: End Loop;
: First_Record;
: Steve Cosner
: ----------------------------------------------------------------------
: http://members.aol.com/stevec5088
: Downloadable Quick Access utility form: Display and update any table.
-- Best regards,Received on Sun Apr 25 1999 - 02:53:37 CEST