Home » Developer & Programmer » Forms » last checked record problem!
last checked record problem! [message #225975] Thu, 22 March 2007 02:41 Go to next message
oracle06
Messages: 36
Registered: December 2005
Member
Hello,
I have a multiple records block there are check boxes associated with each record,when I mark
the checkbox as checked and click on the save button then at the last checked record an error comes
'FRM-41050: you can not update this record',rest checked records successfully works.(problem is only with the last record.)

I am using key-commit trigger on this trigger I am calling save procedure in loop.

Code(Key-commit)trigger:-
go_block('bl_a1');
BEGIN
	   	first_record;
 loop
	     If :bl_a1.APPROVED= 'Y' Then
		 	   Save;
		 	   go_block('bl_a1');
	     END IF;
 	     If :system.last_record = 'TRUE' then
	       Exit;
 	     else
 	     	next_record;
 	     END IF;
 go_block('bl_a1');
	 end loop;
COMMIT_FORM;
END;

Please reply asap.
Thanks.

Upd-mod: Please use code tags.

[Updated on: Thu, 22 March 2007 17:20] by Moderator

Report message to a moderator

Re: last checked record problem! [message #226209 is a reply to message #225975] Thu, 22 March 2007 20:04 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Please post the code in 'Save'.

Do you know on which statement the error is raised? Use 'message/pause' pairs to determine the line on which it fails.

David
Re: last checked record problem! [message #226227 is a reply to message #226209] Thu, 22 March 2007 23:59 Go to previous messageGo to next message
oracle06
Messages: 36
Registered: December 2005
Member
Code for save and C1 :-

PROCEDURE Save IS
Begin
IF Show_Msg('Sure you want to SAVE changes?.','YES_NO') = 1 Then
if :bl_a1.status = 'M' and :bl_a1.t_date is not null then
if Show_Msg('Want to Approve ?','YES_NO') = 1 then
:bl_a1.status := 'A';
end if;
end if;
if :bl_a1.t_date is null then
message('enter a valid date');
message('enter a valid date');
raise form_trigger_failure;
end if;
a1;
b1;
c1;
POST;

d1;
e1;
f1;
commit_form;
GO_BLOCK('bl_a1');
Else
clear_form(no_validate);
g1;
Message('Save Cancelled');
End If;
exception
when others then
message('cannot authorise'||' '||sqlerrm);
message('cannot authorise'||' '||sqlerrm);
raise form_trigger_failure;
End;

----------------------------********----------------------------
PROCEDURE c1 IS
v_gen varchar2(15);
BEGIN
if :bl_a1r.status = 'A' then
if :bl_a1.t_no is null then
v_gen := f_seq(to_char(:bl_a1.t_date,'dd/mm/rrrr'),:bl_a1.t_type,:global.c_code,:global.b_code);
end if;
end if;
If :bl_a1.APPROVED = 'Y' Then
go_block('bl_a2');

if :bl_a2.d_t_no =:bl_a1.d_t_no then
:bl_a2.t_no := v_gen;
:global.v_gen := :bl_a2.t_no;
end if;
:bl_a1.t_no:=v_gen; --------(here is the problem 'you can not update this record')
END IF;
EXCEPTION
WHEN OTHERS THEN
MESSAGE(SQLERRM);
MESSAGE(SQLERRM);
RAISE FORM_TRIGGER_FAILURE;
END;


Thanks.

[Updated on: Fri, 23 March 2007 05:20]

Report message to a moderator

Re: last checked record problem! [message #226283 is a reply to message #226227] Fri, 23 March 2007 02:59 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
You DO realize that v_gen is null, don't you?
Is this really production code? With all the BS-names like c1, d1, bl_a1 etc??
Get rid of your exception handler in c1. It doesn't do anything Forms would not do automatically.

Is bl_a1.t_no updateable?
Re: last checked record problem! [message #226307 is a reply to message #226283] Fri, 23 March 2007 04:10 Go to previous messageGo to next message
oracle06
Messages: 36
Registered: December 2005
Member
Hello Frank,

- v_gen is not null,there is a value.
- Its a production code but actual names are different.
- bl_a1.t_no is updateable.

In the code
bl_a1 master block
bl_a2 detail block

Thanks.
Re: last checked record problem! [message #226315 is a reply to message #226307] Fri, 23 March 2007 04:32 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Quote:
v_gen is not null,there is a value.


In which line does it get a value??
Re: last checked record problem! [message #226341 is a reply to message #226315] Fri, 23 March 2007 05:24 Go to previous messageGo to next message
oracle06
Messages: 36
Registered: December 2005
Member
Sorry Frank,
Code is:-
v_gen := f_seq(to_char(:bl_a1.t_date,'dd/mm/rrrr'),:bl_a1.t_type,:global.c_code,:global.b_code);

please guide.
Thanks.

[Updated on: Fri, 23 March 2007 06:17]

Report message to a moderator

Re: last checked record problem! [message #226628 is a reply to message #226341] Sun, 25 March 2007 23:43 Go to previous messageGo to next message
oracle06
Messages: 36
Registered: December 2005
Member
Hello,
Please tell me how to solve this problem.

Thanks!
Re: last checked record problem! [message #226932 is a reply to message #226628] Tue, 27 March 2007 00:00 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
What datatype is ":bl_a1.t_no"?

Please put "message(':bl_a1r.status=>'||:bl_a1r.status||'<, :bl_a1.t_no=>'||:bl_a1.t_no||'<');pause;' before the line that is failing and show us the result.

David
Re: last checked record problem! [message #228433 is a reply to message #226932] Tue, 03 April 2007 01:04 Go to previous messageGo to next message
oracle06
Messages: 36
Registered: December 2005
Member
Hello David,

datatype for ":bl_a1.t_no" is char in t_no property,
and I am storing t_no value in a variable that is of varchar2(15).I have put the :-
message':bl_a1r.status=>'||:bl_a1r.status||'<, :bl_a1.t_no=>'||:bl_a1.t_no||'<');pause;' before the line that is failing.
Now it is giving messages "Please acknowlwdge" with the same 'FRM-41050: you can not update this record'.

Please tell me what the reason behind that message code you have said to put and what is the use of pause.

please response.

Thanks.
Re: last checked record problem! [message #228443 is a reply to message #228433] Tue, 03 April 2007 01:48 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
The fact that the message line I asked you to display has NOT displayed indicates that the line of code giving the error is NOT the line following the message line. It is one of the lines preceding it.

Please place 'message;pause;' pairs between EVERY statement and determine which line IS causing the failure. Then place the message line I requested before it.

David
Re: last checked record problem! [message #228452 is a reply to message #228443] Tue, 03 April 2007 02:08 Go to previous messageGo to next message
oracle06
Messages: 36
Registered: December 2005
Member
Hello David,
I have put the message before that line where I am getting the error(I catched that code by running form in debug mode):-

message(':bl_a1r.status=>'||:bl_a1r.status||'<, :bl_a1.t_no=>'||:bl_a1.t_no||'<');pause;
:bl_a1.t_no:=v_gen;

Now it is giving messages
":bl_a1r.status=>A<,:bl_a1.t_no=>< "
"Please acknowlwdge"
with the same 'FRM-41050: you can not update this record'.

please response.

Thanks.
Re: last checked record problem! [message #228711 is a reply to message #228452] Tue, 03 April 2007 20:44 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
You said
(I catched that code by running form in debug mode)

Please place the line "message(':bl_a1r.status=>'||:bl_a1r.status||'<, :bl_a1.t_no=>'||:bl_a1.t_no||'<');pause;" AFTER the line ":bl_a1.t_no:=v_gen;" as well as before it.

Tell us the results.

David
Re: last checked record problem! [message #228762 is a reply to message #228711] Wed, 04 April 2007 02:18 Go to previous messageGo to next message
oracle06
Messages: 36
Registered: December 2005
Member
Hello devid,
I have put the message before and after that line.Now I have selected 2 records by clicking on check box,the second record is my last selected(checked)record,here I am giving the results for both.

message(':bl_a1r.status=>'||:bl_a1r.status||'<, :bl_a1.t_no=>'||:bl_a1.t_no||'<');pause;
:bl_a1.t_no:=v_gen;
message(':bl_a1r.status=>'||:bl_a1r.status||'<, :bl_a1.t_no=>'||:bl_a1.t_no||'<');pause;


Now it is giving messages:
for first record:-
":bl_a1r.status=>A<,:bl_a1.t_no=>< " --before statement
":bl_a1r.status=>A<,:bl_a1.t_no=>20060802-00334< " --after statement

for second record (last checked record):-
'FRM-41050: you can not update this record'
":bl_a1r.status=>A<,:bl_a1.t_no=>< " --before statement
'FRM-41050: you can not update this record'
":bl_a1r.status=>A<,:bl_a1.t_no=>< " --after statement

Please response.
Thanks.

[Updated on: Wed, 04 April 2007 02:25]

Report message to a moderator

Re: last checked record problem! [message #229723 is a reply to message #228762] Mon, 09 April 2007 21:00 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Do you have a 'key-down' trigger in which you use 'set_block_property' to turn 'update' 'off'?

David
Previous Topic: how to save more than one record
Next Topic: Time & TimeStamp
Goto Forum:
  


Current Time: Thu Sep 26 18:14:23 CDT 2024