Click to See Complete Forum and Search --> : While loop


mahmood
08-04-2001, 09:44 AM
Hi

Is there any any example of WHILE LOOP in Forms or in Reports?
Thanx.

tron
08-04-2001, 02:04 PM
what are you trying to use the loop for? you can use loops in report triggers i imagine. i have never worked with forms so i don't know about them.

rcherch
08-04-2001, 09:36 PM
Mahomad..

you can you a block level trigger that fires for each row of data is being queried. post-query trigger on the block.

Can you explain what your attempting to accomplish, so we might be able to help you better.

kmesser
08-05-2001, 12:48 PM
Sure.

For example, let's suppose that you wish to display two blocks: a master block and detail block. Upon some event such as the user clicking a button, you want to update all the child records related to the current master. You should never do this via an UPDATE statement. Instead, create a loop and step through each record IN THE FORM which is to be updated:

go_block('DETAILBLOCK');
first_record;
loop
---:detailblock.myfield := somenewvalue;
---exit when :SYSTEM.LAST_RECORD = 'TRUE';
---next_record;
end loop;