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 | Testing for a Particular Value
 
Testing for a Particular Value
In the preceding example, the enclosed block of code executes if a variable named backItems exists in the current scope. To test for the content of a variable, you can apply the following options to the %ifvar% tag.
Use this option...
To...
-isnull
Test whether the specified variable exists and is null.
-notempty
Test whether the specified variable contains a value (i.e., the value is not null or empty).
equals(‘anyString’)
Test whether the specified variable contains a specific value. (variableName must be a String variable to use this option.)
vequals(refVariable)
Test whether the value of the specified variable matches the contents of another variable in the pipeline.
The following example shows an %ifvar%…%else%…%end% construct that executes one of two blocks, depending on the contents of a variable named clubMember.
.
.
.
%invoke orders:getShipInfo%
<H2>Shipping Details for Order %value /oNum%</H2>
<P>Date Shipped: %value shipDate%<BR>
.
.
.
%ifvar clubMember equals(‘Y’)%
%include membershipterms.txt%
%else%
%include nonmembershipterms.txt%
%endifvar%

%endinvoke%
.
.
.
For additional information about the %ifvar% tag, see the %ifvar% description on %ifvar%.