Passing values to alert box

Javra IDE also provides you the way to pass any values to your error message from the procedure logic. You can pass the dynamic or static values as per your need to show them on the alert box. You can use this dynamic feature on a condition specific scenario that may require you to show dynamic values on error message at run-time.

To accomplish this feature, follow the steps explained below:

  • Create an alert box record of any type with placeholders in the error message. Placeholder’s format shall be given as [#<num>] format such as [#1], [#2] . <num> values starts from 1 [#1] and goes upto number of variables you need in the error message. In the image below, an alert box record with error code testerror with 2 placeholders in the error message has been created:
Alert box record of type ‘Error’ created with two placeholders
Figure: Alert box record of type ‘Error’ created with two placeholders
  • Pass the values you want to show in the error message with chr(1) separator in the p-error in the format:

    p-error = “[xerrc]” + chr(1) + “[value1]”. (if only 1 placeholder in the error message)

    p-error = “[xerrc]” + chr(1) + “[value1]” + chr(1) + “[value2]” + chr(1) + .. + “[valuen]” (for n number of placeholders in the error message)

    where,

    [xerrc] : error message code

    [value1]: value to be placed on 1st placeholder i.e. [#1]

    [value2]: value to be placed on 2nd placeholder i.e. [#2]

    [valuen]: value to be placed on nth placeholder i.e.[#n]

{x/xxxxlparam.i}

procedure p-choose:

define variable var1 as character no-undo init "HELLO".
define variable var2 as character no-undo init "WORLD".

if var1 <> var2 then
p-error = 'testerror' + chr(1) + var1 + chr(1) + var2.

end procedure. /* p-choose */

  • Now trigger the event that runs this procedure. You will see your values passed to error message as shown in image below:
Alert box with passed variables from the event logic
Figure: Alert box with passed variables from the event logic

results matching ""

    No results matching ""