Link to home
Start Free TrialLog in
Avatar of NiceMan331
NiceMan331

asked on

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
Avatar of Helena Marková
Helena Marková
Flag of Slovakia image

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.
Avatar of NiceMan331
NiceMan331

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of Helena Marková
Helena Marková
Flag of Slovakia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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;
when i did , no alert at all received , either in the form , neither when F10
How are changes saved ? What does it mean - "because some commit by code within the form i dont need to alert me" ?
when i added the last code regarding message level
the commit done , but no alert
: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.
that is exactly what i did
except i have commit_form instead of commit
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 ?
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
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;
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