infinite loop caused by when-new-item-instance [message #422786] |
Sat, 19 September 2009 03:26 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Martin Eysackers
Messages: 80 Registered: October 2005 Location: Belgium
|
Member |
|
|
Hi all,
I want to loop through my block to make a sum of a field always 100%
see attached fmb
create table shares
(shares number)
/
insert into shares (shares) values (10);
/
insert into shares (shares) values (50);
/
commit;
/
when-new-item-instance is an block level :
(form has 1 block with one item and one summary item (calculated field)
--message(:col_right_type_shares.total_shares);
--message(:col_right_type_shares.total_shares);
--message(:system.last_record);
DECLARE
lv_current_record number;
lv_cursor_item varchar2(61);
BEGIN
message('wvblock.looping ' || :wvblock.looping);
IF nvl(:wvblock.looping, 0) = 0 THEN
-- lv_current_record := get_block_property(:system.trigger_block, current_record);
-- lv_cursor_item := :system.cursor_item;
:wvblock.looping := 1;
first_record;
LOOP
message(:system.last_record);
message('record # ' || get_block_property(:system.trigger_block, current_record));
synchronize;
IF :system.last_record = 'TRUE' THEN
IF :shares.shares <> 100 - :shares.total_shares THEN
:shares.shares := :shares.shares + 100 - :shares.total_shares;
END IF;
END IF;
next_record;
exit when :system.last_record = 'TRUE';
END LOOP;
--go_item(lv_cursor_item);
--go_record(lv_current_record);
-- message(:wvblock.looping);
END IF;
:wvblock.looping := 0;
END;
it loops through the block alright and changes the last record to make the total 100%
unfortunately it keps looping through my block infinitely
I used :wvblock.looping to prevent this but must be doing
something wrong
any ideas I am stuck
Kr
Martin
-
Attachment: shares.fmb
(Size: 48.00KB, Downloaded 1121 times)
[Updated on: Sat, 19 September 2009 21:35] Report message to a moderator
|
|
|
|
|
|
Re: infinite loop caused by when-new-item-instance [message #422997 is a reply to message #422845] |
Mon, 21 September 2009 12:22 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Well, that's something different and - at first sight - much too complicated. How would you determine which records to modify and how if there were50
20
10
7
12
1 and someone modifies 20 to 30; what would you do in that case?
|
|
|