Oracle Form Save Notification

hi
i'm working for oracle db 10g , form 6i
when i'm posting data in the form then i need to save the record
message from orcale comes in the back of the form run time as menstioned in the image
telling me that record commit , or error
i want this message to appear in the form itself to see it , how i can do that
save.jpg
NiceMan331Asked:
Who is Participating?
 
Helena Markováprogrammer-analystCommented:
In triggers you can test error_code or message_code (these codes you can find in the on-line help in description of each FRM-xxxxxx message - the code is xxxxx) and display/not display alert or alert with customized text.

e.g.  for ON-MESSAGE trigger:
IF message_code = 41800 THEN
message(message_text); -- -- message will be displayed in the status bar
ELSIF message_code in (40353, 40301) then
   null; -- message will not be displayed
ELSE
MSG(message_code || chr(10)|| message_text);  -- message will be displayed in alert
END IF;
0
 
Helena Markováprogrammer-analystCommented:
You can do this:
1. create alert - AL_MESSAGE (alert style Note)

2. create a procedure MSG:

PROCEDURE MSG(txt in varchar2) IS
n number;
BEGIN
  set_alert_property('AL_MESSAGE',ALERT_MESSAGE_TEXT,txt);  
  n := show_alert('AL_MESSAGE');
END;


3. In ON-MESSAGE and ON-ERROR triggers on form level you can call procedure MSG:

ON-MESSAGE trigger:
begin
MSG(message_code || chr(10)|| message_text);
end;

ON-ERROR trigger:
begin
MSG(error_code || chr(10)|| error_text);
end;

I hope this will be a little help for you.
0
 
NiceMan331Author Commented:
OK , this works well
but if i don't' want to show the error as message , i want to display it in a text box
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
NiceMan331Author Commented:
great
now one thing , i will search for message code of commit
but i need the message to be alert only when i press f10
because some commit by code within the form i dont need to alert me
0
 
Helena Markováprogrammer-analystCommented:
In such a case you can set :system.message_level to 20 before using commit in form code (this will suppress messages which level is below 20). Error messages cannot be suppressed.

:system.message_level := 20;
commit;
:system.message_level := 5;
0
 
NiceMan331Author Commented:
when i did , no alert at all received , either in the form , neither when F10
0
 
Helena Markováprogrammer-analystCommented:
How are changes saved ? What does it mean - "because some commit by code within the form i dont need to alert me" ?
0
 
NiceMan331Author Commented:
when i added the last code regarding message level
the commit done , but no alert
0
 
Helena Markováprogrammer-analystCommented:
:system.message_level := 20;  -- this line suppresses messages below level 20
 commit; -- commit without message
:system.message_level := 5; -- this line set message level to the lower value = 5, so every message will be displayed

You can put these 3 lines to the places where you use commit (or COMMIT_FORM)  and want to suppress messages.
0
 
NiceMan331Author Commented:
that is exactly what i did
except i have commit_form instead of commit
0
 
Helena Markováprogrammer-analystCommented:
So it is all right: there are no messages (alert), because messages which level is lower than 20 are suppressed.

This is from the on-line help:

Description
 
SYSTEM.MESSAGE_LEVEL stores one of the following message severity levels: 0, 5, 10, 15, 20, or 25. The default value is 0.

SYSTEM.MESSAGE_LEVEL can be set to either a character string or a number. The values assigned can be any value between 0 and 25, but values lower than 0 or higher than 25 will generate an error.

During a Runform session, Oracle Forms suppresses all messages with a severity level that is the same or lower (less severe) than the indicated severity level.

Assign a value to the SYSTEM.MESSAGE_LEVEL system variable with standard PL/SQL syntax:

:System.Message_Level := value;

The legal values for SYSTEM.MESSAGE_LEVEL are 0, 5, 10, 15, 20,and 25. Oracle Forms does not suppress prompts or vital error messages, no matter what severity level you select.

SYSTEM.MESSAGE_LEVEL Example
 
Assume that you want Oracle Forms to display only the most severe messages (level 25). The following Pre-Form trigger suppresses all messages at levels 20 and below. :System.Message_Level := '20';

What is problem ?
0
 
NiceMan331Author Commented:
i agree with you , but i really i don't know what happened
any how , if no more suggest , i will accept your answer & close it
waiting for your last comment
thanx alot
0
 
Helena Markováprogrammer-analystCommented:
If you remove all settings of :System.Message_Level, then all messages will be displayed.

You can also store system.message_level to a variable, set it before commit_form to the desired level and then set it back to its origin value.

v_msg_level := :system.message_level;
:system.message_level := 0; -- all messages will be displayed
 commit_form;
 :system.message_level := v_msg_level;
0
 
NiceMan331Author Commented:
yes now correct
but after i changed the value to be 20

v_msg_level := :system.message_level;
:system.message_level :=20; -- all messages will be displayed
 commit_form;
 :system.message_level := v_msg_level; 

Open in new window

thanx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.