Dynamic Alert Message in Oracle Forms.
Introduction:
The Alert Message need to be changed at run time based on the condition criteria.
Cause of the issue:
In Oracle Forms, we have a standard functionality to create a Alert with a single message and buttons. But we user requested to display the different alert message at run time based on the criteria that matches.
How do we solve:
The below is the Property to create or change a alert message using SET_ALERT_PROPERTY and Buttons label using SET_ALERT_BUTTON_PROPERTY during run time.
Script:
DECLARE
p_value NUMBER;
BEGIN
p_value := 120;
SET_ALERT_BUTTON_PROPERTY (‘alert_name’, alert_button1, label, ‘Yes’);
SET_ALERT_BUTTON_PROPERTY (‘alert_name’, alert_button2, label, ‘No’);
SET_ALERT_PROPERTY (‘alert_name’,
alert_message_text,
‘Do you want continue value Exceeds’ || p_value || ‘?’
);
n := SHOW_ALERT (‘alert_name’);
IF n = alert_button1
THEN
:sel_button := ‘You choose Yes to Continue’;
ELSE
:sel_button := ‘You choose NO to Stop’;
END IF;
END;