Conditionally cause an immediate change in the flow of execution.
The <branch> element causes an immediate change in the flow of execution if the value of its condition expression is true. Control passes to the <label> element whose name is specified as the value of the label attribute in the <branch>.
In the following BPL example, if the condition expression is true, the flow of control shifts directly from the <branch> with the label value TraceSkipped to the <label> with the name value TraceSkipped, while the intervening <trace> element is ignored:
<branch condition="myVar='1'" label="TraceSkipped" />
<trace value="Ignore me when myVar is 1..." />
<label name="TraceSkipped" />
If the <branch> condition expression is false, control simply passes to the next BPL statement following the <branch>, in this case <trace>.
A destination <label> must be in the same scope as the <branch> that references it. Thus:
Each <sequence> element within a <flow> has its own <label> scope. The BPL execution engine prevents any attempt to <branch> to a <label> outside the current <sequence> container.
There are similar restrictions on any other BPL container element that controls the flow of execution at runtime. Each container has its own <label> scope.
In addition to these restrictions, each <label> name value must be unique across the entire BPL business process, not just within the current scope.
As is true in all programming languages, the BPL branch mechanism must be used with care. The BPL editor does not prevent basic programming mistakes such as infinite loops or invalid branch cases.