Evaluate a condition and perform one action if true, another if false.
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.
The following example shows an <if> element used to coordinate the results of a combination of <call> and <sync> elements used together.
<call name="A" />
<call name="B" />
<sync calls="A,B" type="all" timeout="10" />
// Did the synchronization time out before it finished?
<trace value="thread1 timeout: Call A or B did not return." />
// If not, then the calls came back, so assign the results.
The <if> activity in this example has a condition that tests the execution context variable synctimedout against the integer value 1. synctimedout can have the value 0, 1, or 2 as described in the documentation for <call>. If the two values are equal, this <if> condition receives the integer value 1 and statements inside the <true> element are executed. Otherwise, statements inside the <false> element are executed.
There is more information about the business process execution context in documentation of the <assign> element.