7.15 <RDML ONCONDITION>

Syntax:

<RDML ONCONDITION=”<field>” VALUE=”<value>”>

</RDML>

 

Description:

These tags are used by LANSA to determine if the lines encapsulated by these tags should be sent to the browser or not.

These tags allow you to programmatically set the contents of a field depending on certain logical conditions.

The <field> can be:

  • A field in your LANSA Web function.
  • A system variable.
  • A reserved keyword.

If the field, <field>, exists or the contents of the field is non-blank or not zero, then the lines are sent to the browser, provided the <value> parameter is not specified.

The  <value> parameter is optional. If the <value> is specified, then the lines are only sent to the browser if the current field value matches the value parameter.

There are reserved <field> values. These are special instructions for LANSA Web functions. These are:

  • &DEBUG

Check if batch debugging is enabled in the initial URL request. If it is, the subsequent URL is modified to include the BDEBUG keyword before the request is submitted.

  • &TASK

Check if a task identifier is specified in the initial URL request. If it is, the subsequent URL is modified to include the TASK_ID keyword and the task identifier before the request is submitted.

  • &USETMPFLD<index>

This is an instruction to check the HTML working fields identified by <index>. The <RDML SETTMPFLD> tag is used to set the values of these working fields. This specialized field is used to retrieve a particular working field. Do not use this keyword if you do not understand this description.

 

 

If the field is numeric and fieldname does not exist or the value is “0”, then the lines encapsulated by the tags ARE NOT sent to the browser.

If the field is alpha and fieldname does not exist or the value is “0” or is blank, then the lines encapsulated by the tags ARE NOT sent to the browser.

Consider the following example:

<RDML ONCONDITION="DISCOUNT">

   <h2>Your discount amount is:</h2>

   <RDML MERGE="DISCOUNT">

</RDML> 

If the field DISCOUNT exists, then the user will see the message.

Let the DISCOUNT field be numeric. If in the RDML function the DISCOUNT field is “0”, then the HTML will not be used and information about the discount will not be displayed to the user. When the discount is not zero, the user will see the discount amount displayed.

Let the DISCOUNT field be alpha. If in the RDML function the DISCOUNT field is blank, then the HTML will not be used and information about the discount will not be displayed to the user. If the discount is “50 percent”, then the user will see the discount amount displayed.

The following example uses a value:

<RDML ONCONDITION="DISCOUNT" VALUE="50">

   <h2>Your discount amount is 50.</h2>

   <RDML MERGE="DISCOUNT">

</RDML>