Home » Developer & Programmer » Forms » How handle Oracle Form own generated Error
How handle Oracle Form own generated Error [message #336475] Sun, 27 July 2008 12:29 Go to next message
Shaheer
Messages: 50
Registered: June 2008
Location: Pakistan
Member
Respected Sir,

Please see attached file.

In my form one field that takes five digits. for example (00411) and i set its format mask (99-999). When i put less then 5 digits in the field, Oracle Form generate its own Error i.e. FRM-40209 Field must be of Form 99"-"999. I also declare my own alert for this error. but First Oracle Form Display its own Error and then my Alert display.

i want to display my own alert instead of Oracle Form own generated Error. please post the solution.
  • Attachment: error.GIF
    (Size: 65.58KB, Downloaded 400 times)

[Updated on: Sun, 27 July 2008 12:36]

Report message to a moderator

Re: How handle Oracle Form own generated Error [message #336858 is a reply to message #336475] Tue, 29 July 2008 04:22 Go to previous messageGo to next message
sasipalarivattom
Messages: 118
Registered: June 2007
Location: Cochin ( INDIA )
Senior Member

Dear Shaheer ,

Can you please answer these questions?

1. Are you calling the alert in WHEN-VALIDATE-TRIGGER of the Account No field?
2. Do you have any code in on-error trigger to suppress the default error message ?

Waiting for your reply.

Regards
Sasi..
Re: How handle Oracle Form own generated Error [message #336914 is a reply to message #336858] Tue, 29 July 2008 06:05 Go to previous messageGo to next message
Shaheer
Messages: 50
Registered: June 2008
Location: Pakistan
Member
1) No Sir, i call alert from KEY_NEXT_ITEM trigger. In this trigger i use if condition

if (length(:blockname.fieldname) = 5 )then
go_item('fieldname');
else
i call my own alert;
end if;
2) No Sir, i cannot define No_ERROR Trigger.
Re: How handle Oracle Form own generated Error [message #336917 is a reply to message #336914] Tue, 29 July 2008 06:16 Go to previous messageGo to next message
Littlefoot
Messages: 20894
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You "can not" create ON-ERROR trigger, or you "did not" create it?

If you didn't, why wouldn't you? There's been an example recently on the board - search for ON-ERROR keyword and you'll even find an example.
Re: How handle Oracle Form own generated Error [message #336931 is a reply to message #336917] Tue, 29 July 2008 07:05 Go to previous messageGo to next message
Shaheer
Messages: 50
Registered: June 2008
Location: Pakistan
Member
Respected Sir,
how to create ON_ERROR trigger. i want to replace Form own generated Error into my define alert. please post example of ON_ERROR trigger.
thanks
Re: How handle Oracle Form own generated Error [message #336940 is a reply to message #336931] Tue, 29 July 2008 07:29 Go to previous messageGo to next message
sasipalarivattom
Messages: 118
Registered: June 2007
Location: Cochin ( INDIA )
Senior Member

Dear Shaheer,

Create an ON-ERROR Trigger for the form module.
now in that trigger , you can write code to show your own error messages.

Eg Code.

declare
itm varchar2(100);
begin
if (MESSAGE_TYPE = 'FRM' and MESSAGE_CODE = '40209')  then
  	itm := get_item_property(name_in('system.trigger_item'),prompt_text);
if upper(itm) = " Prompt text " then
  	message('Please Enter 5 Digit Account Code');
else
        message(sqlerrm);
end if;
else
        message(sqlerrm);
end if;
end;


Don't copy paste the codes.
Try to understand it and in case of any doubt, ask orafaq for clarification.

Regards
Sasi...

Re: How handle Oracle Form own generated Error [message #336945 is a reply to message #336940] Tue, 29 July 2008 07:35 Go to previous messageGo to next message
Littlefoot
Messages: 20894
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What's the purpose of the whole "GET_ITEM_PROPERTY" story? What is
if upper(itm) = " Prompt text " then
supposed to do?

Why not simply (the whole trigger code)
if MESSAGE_TYPE = 'FRM' and MESSAGE_CODE = '40209' then
   message('Please Enter 5 Digit Account Code');
end if;

Re: How handle Oracle Form own generated Error [message #336974 is a reply to message #336945] Tue, 29 July 2008 08:45 Go to previous messageGo to next message
sasipalarivattom
Messages: 118
Registered: June 2007
Location: Cochin ( INDIA )
Senior Member

Hi littlefoot,

FRM 40209 error is
"The value that you entered did not match the format mask on the field."

Here Shaheer just need to set error report for Account code only.
That's why i wote like that.

For example,
there same error will come if user enter some character in a number type field.

so we have to check in which field the error occurred and ned to show appropreate messages.
That's why the code like this.

here i am checking the prompt of the item.
i tried with the item name like this

if :system.trigger_item = :BLOCK_NAME.ITEMNAME then
 message(' Error ');
end if;


but sometimes it doesn't work. that's why i use the prompt name.

Regards
Sasi...

[Updated on: Tue, 29 July 2008 08:51]

Report message to a moderator

Re: How handle Oracle Form own generated Error [message #338140 is a reply to message #336974] Sun, 03 August 2008 23:43 Go to previous messageGo to next message
sasipalarivattom
Messages: 118
Registered: June 2007
Location: Cochin ( INDIA )
Senior Member

Dear All,

There is a change in the last post..
I wrote the code like

if :system.trigger_item = :BLOCK_NAME.ITEMNAME then
 message(' Error ');
end if;


it is wrong and the correct one is

if :system.trigger_item = BLOCK_NAME.ITEMNAME then
 message(' Error ');
end if;


Sorry for the mistake.

Thanks and Regards
Sasi...

[Updated on: Sun, 03 August 2008 23:44]

Report message to a moderator

Re: How handle Oracle Form own generated Error [message #338148 is a reply to message #338140] Mon, 04 August 2008 00:05 Go to previous messageGo to next message
Littlefoot
Messages: 20894
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Nope. YOU are wrong.

The correct syntax is
if :system.trigger_item = :BLOCK_NAME.ITEMNAME then
while the wrong syntax is
if :system.trigger_item = BLOCK_NAME.ITEMNAME then
as it produces
Forms
Tabke, View or Sequence reference 'BLOCK_NAME.ITEMNAME' not allowed in this context
Re: How handle Oracle Form own generated Error [message #338161 is a reply to message #338148] Mon, 04 August 2008 00:52 Go to previous messageGo to next message
sasipalarivattom
Messages: 118
Registered: June 2007
Location: Cochin ( INDIA )
Senior Member

Hi littlefoot,

I think there is some misunderstanding.

i shall explain it with an example.

1. My datablock name is BANK
2. ACCOUNTCODE is the item in this block.
3. Now in ACCOUNTCODE field, value entered as 123

Now in the ON-ERROR trigger, I want to check whether the error is occurred with ACCOUNTCODE item.

So my code will be like this

if :system.trigger_item = 'BANK.ACCOUNTCODE' then

and not
if :system.trigger_item = :BANK.ACCOUNTCODE then

In the second case it will check the value of field ACCOUNTCODE , that is 123.

This is what I mean by BLOCK_NAME.ITEMNAME.

Thanks and Regards,
Sasi...

Re: How handle Oracle Form own generated Error [message #338171 is a reply to message #338161] Mon, 04 August 2008 01:31 Go to previous messageGo to next message
Littlefoot
Messages: 20894
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
LOL! Right, a major misunderstanding (along with me being sloppy).

if :system.trigger_item = 'BANK.ACCOUNTCODE' then
is OK (i.e. block and item name enclosed into the single quotes).
Re: How handle Oracle Form own generated Error [message #338853 is a reply to message #336931] Wed, 06 August 2008 02:13 Go to previous message
sasipalarivattom
Messages: 118
Registered: June 2007
Location: Cochin ( INDIA )
Senior Member

Hello Shaheer ,

Did you solve your problem ?
Previous Topic: FIND_FORM error
Next Topic: Really Need Help
Goto Forum:
  


Current Time: Mon Dec 05 12:40:53 CST 2016

Total time taken to generate the page: 0.17036 seconds