This discussion is archived
3 Replies Latest reply: May 10, 2012 5:52 PM by Amatu Allah RSS

default setting for message built-in

oradba101 Newbie
Currently Being Moderated

Is there a global setting to "turn on" ACKNOWLEDGE in the MESSAGE built-in?


Bill Chadbourne
  • 1. Re: default setting for message built-in
    Michael Ferrante (Oracle) Guru Moderator
    Currently Being Moderated
    The best way to force an alert is to repeat the message. By design, "ACKNOWLEDGE" is the default. The problem is that understanding how it works is often misunderstood. For example:
    Here is the text from the online help.


    <blockquote>Specify a character string enclosed in single quotes or a variable of VARCHAR2 data type.  </blockquote>
    <blockquote>Specifies one of the following constants:

    ACKNOWLEDGE Specifies that Oracle Forms is to display a modal alert that the operator must dismiss explicitly, whenever two consecutive messages are issued*. ACKNOWLEDGE forces the first message to be acknowledged before the second message can be displayed. This is the default.

    NO_ACKNOWLEDGE Specifies that, when two consecutive messages are issued, the operator is not expected to respond to the first message displayed before Oracle Forms displays a second message. Using NO_ACKNOWLEDGE creates a risk that the operator may not see the first message, because the second message immediately overwrites it without prompting the operator for acknowledgement. </blockquote>
  • 2. Re: default setting for message built-in
    CraigB Guru
    Currently Being Moderated
    Michael is write about how the ACKNOWLEDGE parameter works. If you need a message to display in an Alert then you might want to consider creating your own library package that will simplify the display of messages. For example, on the project I'm working on, we have created a messenger packages that lets you specify the type of alert (NOTE, CAUTION, STOP) or the Status Bar where you want the message to appear. Additionally, if you need more than the "OK" button, the package allows you to specify the button labels and easily check which button the user selected.

    You could also create individual Alert objects and Show the particular Alert you want. I find this tedious and you end up with multiple Alert objects when you really only need three (3); one for each type of Alert (NOTE, CAUTION and STOP). I much prefer a package wrapper to this method. A package wrapper is a little more work to setup, but it offers the greatest flexibility - in my opinion. :)

    Using the package wrapper method also allows you to display informational or warning messages without using the default STOP alert that you get when you promote the message to an Alert using the MESSAGE(' '); MESSAGE(' '); method.

    Here is the basic package specification we use. For this to work, you will need to create three (3) Alert objects and name them NOTE, CAUTION and STOP and set the Alert Type Property of each accordingly.
    PACKAGE Messenger IS
       Procedure Set_Buttons (p_alert_type VARCHAR2, p_button1 VARCHAR2, p_button2 VARCHAR2, p_button3 VARCHAR2);
       Procedure Set_Title ( p_alert_type VARCHAR2, p_title VARCHAR2);
       Procedure Show ( p_alert_type VARCHAR2, p_message_text VARCHAR2);
       Function Button1_Pressed RETURN BOOLEAN;
       Function Button2_Pressed RETURN BOOLEAN;
       Function Button3_Pressed RETURN BOOLEAN;
    END Messenger;
    PACKAGE BODY Messenger IS
      --Private Package Globals
      n_button_pressed  NUMBER;
      G_ALERT_TYPE     VARCHAR2(1);
      G_ALERT_ID       ALERT;
      Procedure reset_alert IS
        alert_id    ALERT;
        IF ( G_ALERT_TYPE = 'N' ) THEN -- Note Alert
          alert_id := Find_Alert('NOTE');
          Set_Alert_Property(alert_id, TITLE, 'Information');
        ELSIF ( G_ALERT_TYPE = 'C' ) THEN  -- Caution Alert
          alert_id := Find_Alert('CAUTION');
          Set_Alert_Property(alert_id, TITLE, 'Caution');
        ELSE  -- Assumed to be the STOP alert.
          alert_id := Find_Alert('STOP');
          Set_Alert_Property(alert_id, TITLE, 'Stop');
        END IF;
        --Now reset any alert buttons that might have been set.
        Set_Alert_Button_Property(alert_id, ALERT_BUTTON1, LABEL, 'OK');
        Set_Alert_Button_Property(alert_id, ALERT_BUTTON2, LABEL, NULL);
        Set_Alert_Button_Property(alert_id, ALERT_BUTTON3, LABEL, NULL);
      Procedure Set_Alert_ID ( p_alert_id VARCHAR2 ) IS
        IF ( p_alert_type = 'N' ) THEN 
          G_ALERT_ID := Find_Alert('NOTE');
        ELSIF ( p_alert_type = 'C' ) THEN 
          G_ALERT_ID := Find_Alert('CAUTION');
        ELSE -- Assume STOP alert
          G_ALERT_ID := Find_Alert('STOP');
        END IF;
      END Set_Alert_ID;
      Procedure Set_Buttons(p_alert_type VARCHAR2, p_button1 VARCHAR2
                          , p_button2 VARCHAR2, p_button3 VARCHAR2) IS
        Set_Alert_ID(p_alert_type VARCHAR2);
        IF ( p_button1 IS NOT NULL ) THEN 
          Set_Alert_Button_Property(G_ALERT_ID, ALERT_BUTTON1, LABEL, p_button1);
        END IF;
        IF ( p_button2 IS NOT NULL ) THEN 
          Set_Alert_Button_Property(G_ALERT_ID, ALERT_BUTTON2, LABEL, p_button2);
        END IF;
        IF ( p_button3 IS NOT NULL ) THEN 
          Set_Alert_Button_Property(G_ALERT_ID, ALERT_BUTTON3, LABEL, p_button3);
        END IF;
      END Set_Buttons;
      Procedure Set_Title ( p_alert_type VARCHAR2, p_title VARCHAR2 ) IS
        Set_Alert_ID (p_alert_type VARCHAR2);    
        Set_Alert_Property(G_ALERT_ID, TITLE, p_title);
      END Set_Alert;
      Procedure Show ( p_alert_type VARCHAR2, p_message_text VARCHAR2 ) IS
        G_ALERT_TYPE := UPPER(P_alert_type);
        IF ( G_ALERT_TYPE = 'SB' ) THEN  --Status Bar
          Set_Alert_ID (G_ALERT_TYPE VARCHAR2);
          Set_Alert_Property(G_ALERT_ID, ALERT_MESSAGE_TEXT, p_message_text);
          n_button_pressed := Show_Alert(G_ALERT_ID);
        END IF;
      END Show;
        b_ret_val   BOOLEAN := FALSE;
        IF ( n_button_pressed = ALERT_BUTTON1 ) THEN 
          b_ret_val := TRUE;
        END IF;
        RETURN b_ret_val;
      END Button1_Pressed;
        b_ret_val   BOOLEAN := FALSE;
        IF ( n_button_pressed = ALERT_BUTTON2 ) THEN 
          b_ret_val := TRUE;
        END IF;
        RETURN b_ret_val;
      END Button2_Pressed;
        b_ret_val   BOOLEAN := FALSE;
        IF ( n_button_pressed = ALERT_BUTTON3 ) THEN 
          b_ret_val := TRUE;
        END IF;
        RETURN b_ret_val;
      END Button3_Pressed;
    END Messenger;
    Disclaimer: I adapted our process and simplified it for this sample. I have not compiled this code so it may have syntax errors. This code sample is simply to provide you with basic structure of a message wrapper package. I suggest you use this only as the basis of your own wrapper package.

    Hope this helps,
    Craig B-)

    If someone's response is helpful or correct, please mark it accordingly.
  • 3. Re: default setting for message built-in
    Amatu Allah Guru
    Currently Being Moderated
    Hi Bill

    To Summarize, if u want ur message to pop up in a smal modal window then use ACKNOWLEDEG
    if u want ur message to be displayed in a line status bar then use NO_ACKNOWLDEGE

    u can also use..
    MESSAGE(' ur_message text....');
    Hope this help...


    Amatu Allah.


  • Correct Answers - 10 points
  • Helpful Answers - 5 points