2 Replies Latest reply: Feb 22, 2013 3:01 AM by luno RSS

    Usage of placeholders in apex_error

    luno
      Hi everyone,

      I am using APEX 4.1.
      Using the documentation ([http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/apex_error.htm#CABGDEDC]) I'm trying to implement my own custom error message.
      My problem: The placeholders in the text message are not replaced and I don't know what I'm doing wrong.

      Example:
      APEX_ERROR.ADD_ERROR (
           p_error_code => 'This is a text message with one placeholder: %0',
           p0 => my_variable,
           p_display_location => apex_error.c_inline_with_field_and_notif,
           p_page_item_name => 'P13_MY_PAGE_ITEM'
      );
      The result is an error message as follows:
      This is a text message with one placeholder: %0 (Go to error)
      Any suggestions?

      Thanks in advance.

      Regards,
      luno
        • 1. Re: Usage of placeholders in apex_error
          Ramesh P, Oracle APEX Developer
          This is only added to error stack.

          p0 => my_variable,

          Nothing for display.
          • 2. Re: Usage of placeholders in apex_error
            luno
            Ok, got the solution.

            Just to share.. I didn't know this:
            If I add a Text Message to my application, I can make use of the placeholders.

            Example:
            1. Create a Text Message (Name: MSG_ERROR_FORMAT_CHECK):
            %0 does not match required format %1.
            2. During PL/SQL execution, add an error:
            APEX_ERROR.ADD_ERROR (
                 p_error_code => 'MSG_ERROR_FORMAT_CHECK',
                 p0 => 'label',
                 p1 => '[XX.YYY]',
                 p_display_location => apex_error.c_inline_with_field_and_notif,
                 p_page_item_name => 'P13_PAGE_ITEM'
            );