Software AG Products 10.7 | Integrating On-Premises and Cloud Applications | Service Development | Building Flow Services | The BRANCH Step | Branching on Null and Empty Values
 
Branching on Null and Empty Values
When you build a BRANCH step, you can include target steps that match null or empty switch values. The BRANCH step considers a switch value to be null if the variable does not exist in the pipeline or is explicitly set to null. The BRANCH step considers a switch value to be an empty string if the variable exists in the pipeline but its value is a zero length string. To branch on null or empty values, set the Label property for the target step as follows.
To BRANCH on...
Do the following...
A null value
Set the Label property to $null. At run time, the BRANCH step executes the target step with the $null label if the switch variable is explicitly set to null or does not exist in the pipeline.
You can use $null with any type of switch variable.
An empty string
Leave the Label property blank (empty). At run time, the BRANCH step executes the target step with no label if the switch variable is present, but contains no characters.
You can use an empty value only when the switch variable is of type String.
Important:
If you branch on expressions (Evaluate labels is set to True), you cannot branch on null or empty values. When executing the BRANCH step and evaluating labels, Integration Server ignores target steps with a blank or $null label.
The following example shows a BRANCH step used to authorize a credit card number based on the buyer’s credit card type (CreditCardType). It contains three target steps. The first target step handles situations where the value of CreditCardType is null or where CreditCardType does not exist in the pipeline. The second target step handles cases where the value of CreditCardType is an empty string. (Note that the first two target steps are EXIT steps that will return a failure condition when executed.) The third target step has the $default label, and will process all specified credit card types.
BRANCH that contains target steps to match null values or empty strings