Skip to main content

<branch>

Conditionally cause an immediate change in the flow of execution.

Syntax

<branch condition="myVar='1'" label="JumpToMe" />

Details

Attribute or Element Description Value
condition attribute Required. An expression that, if true, causes the flow of control to jump to the identified <label>. An expression that evaluates to the integer value 1 (if true) or 0 (if false). The expression must use the scripting language specified by the containing <process> element.
label attribute Required. The name of the <label> to jump to. A string of 0 to 255 characters.
name, disabled, xpos, ypos, xend, yend attribute See “Common Attributes and Elements.”  
<annotation> element

Description

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.

Caution:

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.

FeedbackOpens in a new tab