Software AG Products 10.7 | Integrating On-Premises and Cloud Applications | DSPs and building output templates | Using Dynamic Server Pages (DSPs) | Using the DSP Tags | Conditionally Executing Blocks of Code | Building Conditional Blocks With the %ifvar% Tag
 
Building Conditional Blocks With the %ifvar% Tag
The %ifvar% tag is similar to an “if…then…else” expression in other programming languages. You use it to denote a block of code that is to be executed only when a specified variable exists or contains a value that you specify.
The basic format of the %ifvar% tag is as follows, where variableName specifies the name of the variable that will be evaluated at run time:
%ifvar variableName%
Block of Code
[%else%
Block of Code]
%end%
Example
.
.
.
<!--Check for presence of backordered items in the order -->
<!--and display if they exist -->
%ifvar backItems%
<p>Backordered Items
%loop backItems%
%value%<BR>
%endloop%
%endifvar%

.
.
.