loop to commit more than 1 record ? [message #463756] |
Sat, 03 July 2010 02:19 |
ahmed_samir
Messages: 61 Registered: January 2009 Location: EGYPT
|
Member |
|
|
hi there i made this loop to commit the same item but depend on the count of suppliers to set the same item every time to defferent supplier .
but the problem this code commit only the first sypplier but not any othere one ..
code : { key - commit - trigger }
declare
var_record_count number ;
VAR_p_request number;
begin
var_record_count:= get_block_property('control',CURRENT_RECORD);
--go_block('PURCH_PRICE_REQUEST');
--first_record;
go_block('PURCH_ITEMS_PRICE');
first_record;
------------------------------ loop in side loop -------------
go_block('control');
first_record;
for i in 1 .. var_record_count
loop
select SEQ_FAHS_ID.NEXTVAL into :global.var_p_request from dual;
:PURCH_PRICE_REQUEST.P_REQUEST_ID:=:global.var_p_request;
:PURCH_ITEMS_PRICE.P_REQUEST_ID:=:global.var_p_request;
:PURCH_PRICE_REQUEST.SUPP_ID :=:control.TXT_SUPP;
commit_form;
--Post;
next_record;
-- message(i);
end loop;
end ;
thanks
[Updated on: Sat, 03 July 2010 02:24] Report message to a moderator
|
|
|
Re: loop to commit more than 1 record ? [message #463760 is a reply to message #463756] |
Sat, 03 July 2010 02:46 |
ahmed_samir
Messages: 61 Registered: January 2009 Location: EGYPT
|
Member |
|
|
when am try to save this form ..
the first record saved but the second say " can't update " i think the form expect that the first record saved coz it's new record .. but the second record not saved coz the form expect that update will happen .
how to solve this case .. !!
thanks
|
|
|
Re: loop to commit more than 1 record ? [message #463792 is a reply to message #463760] |
Sat, 03 July 2010 11:00 |
|
Littlefoot
Messages: 21818 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Set whatever you need.
Commit only once, at the end.
What is "var_record_count" set to? To a current record, right. But - which one is it? If you have just entered the block, it is the first record. Perhaps you should first LAST_RECORD, set the "var_record_count", then FIRST_RECORD and, finally, loop.
|
|
|