docs.intersystems.com
Home  /  Application Development: Creating Productions  /  Business Process and Data Transformation Language Reference  /  DTL Elements  /  DTL <if>


Business Process and Data Transformation Language Reference
DTL <if>
[Back]  [Next] 
InterSystems: The power behind what matters   
Search:  


Evaluate a condition and perform one action if true, another if false.
Synopsis
<if condition="1">   <true>     ...   </true>   <false>     ...   </false> </if>
Attributes
Attribute Description Value
condition Required. An ObjectScript expression that, if true, causes the contents of the <true> element to execute. If false, the contents of the <false> element are executed. An expression that evaluates to the integer value 1 (if true) or 0 (if false).
Elements
Element Purpose
<annotation> Optional. A text string that describes the <if> element.
<true> Optional. If the condition is true, activities inside the <true> element are executed.
<false> Optional. If the condition is false, activities inside the <false> element are executed.
Description
The <if> element evaluates an expression and, depending on its value, executes one of two sets of activities (one if the expression evaluates to a true value, the other if it evaluates to a false value).
The <if> element may contain a <true> element and a <false> element which define the actions to execute if the expression evaluates to true or false, respectively.
If both <true> and <false> elements are provided, they may appear within the <if> element in any order.
If the condition is true and there is no <true> element, or if the condition is false and there is no <false> element, no activity results from the <if> element.