You can change an alert message at runtime by executing the SET_ALERT_PROPERTY Built-in. Changing an alert's message allows you to reuse the same alert object, but display a different message each time it is invoked.
For example, it is common to have several alerts in an application that use the same two buttons (for example, OK and Cancel) but display different messages depending on application context.
By programmatically changing an alert's message to fit the current context, you can save design overhead by reusing the same alert object instead of creating multiple alerts. Changing the alert message also enables you to create dynamic alert messages that refer to specific objects or item values.
The following example changes the message of an alert named generic_alert. This alert is informational only and has only one button, labeled "OK":
DECLARE
alert_id ALERT := Find_Alert('generic_alert');
dummy_var NUMBER;
BEGIN
Set_Alert_Property(alert_id, ALERT_MESSAGE_TEXT, 'The product
you selected is not in stock');
-- now show the alert
dummy_var := Show_Alert(alert_id);
END;
Notice that in this example, no action is taken when the operator selects a button because the alert is informational only, and has only one button, OK. The return value of the SHOW_ALERT function is assigned to a dummy variable when the operator acknowledges the message, and processing continues normally.
Note also that the example uses the FIND_ALERT function to get the object ID
for the alert named generic_alert. The ID is assigned to the variable
alert_id. The alert is then referenced by
ID in the subsequent procedure and function calls.