Email Us : sunilkumark11@gmail.com
Free Training > SQL PL / SQL Forms Reports Oracle Applications
< Previous Next >

 
Forms - Alerts

Used to display messages programmatically.
Message will be displayed in a window.
Supports to provide action based on button selected in message box.
It will deactivate other application screens.
Alert Styles
There are three styles of Alert.
1) Note
2) Caution
3) Stop

Example
Create a new table EMPFOUR  same as standard EMP table.
Create new form EMP_ALT.FMB using data block wizard and layout wizard.
In object navigator , select Alerts and click on create.

In the property palette of the  Alert, provide the following details.
General
Name -- A1
Functional
Title -- Save Alert
Message -- Do you want to save changes
Alert Style -- Stop
Button 1 Label  --  Yes
Button 2 Label -- No
In the Layout editor, create a button.
In the property palette of the button,
Name -- B1
Label -- Save

Create WHEN-BUTTON-PRESSED  trigger for the button B1 and provide the following code.

 

declare
a number;
begin
a := show_alert ('A1');
if a = alert_button1 then
commit_form;
else
null;
end if;
end;

Click on compile, we should get confirmation message.
Note
show_alert is a built_in, used to display alert.

Create another button in the layout editor,
In the property palette of the button,
Name -- B2
Label -- Quit

 

Create another alert, provide the following properties

General
Name -- A2

Functional
Title -- Quit Alert
Message -- Do you want  to quit the Application ?
Alert Style -- Stop
Button 1 Label -- OK
Button 2 Label  -- Cancel

Create WHEN-BUTTON-PRESSED  trigger for the button B2 and provide the following code.

declare
a number;
begin
a := show_alert ('A2');
if a = alert_button1 then
exit_form;
else
null;
end if;
end;

Click on compile, we should get confirmation message.
Now, Lets save the form  (  File Save )
Compile the from ( Program Compile Module )
Run the form ( Program Run Form )
Enter Empno and Ename 
Click on Save button, Alert is displayed.

Similarly, click on Quit button, Quit Alert is displayed.

 


< Previous Next >