Building Your Event-Driven Architecture : Service Development Help : Building Flow Services : The BRANCH Step : Branching on a Switch Value : Specifying the Label Value
Specifying the Label Value
At run time, the BRANCH step compares the value of the switch variable to the Label property of each of its targets. It executes the target step whose label matches the value of the switch variable.
You can use a regular expression to specify the matching value for a BRANCH step. To do so, use the following syntax to specify the value in Label:
/RegularExpression/
For example, if you want to select a step based on whether a PO number starts with the string “REL” you use /^REL/ as the value of Label. For more information, see Regular Expressions.
Unlike other flow steps whose children execute in sequence at run time, only one child of a BRANCH step is executed: the target whose label matches the value of the switch variable. If none of the targets match the switch variable, none of them are performed, and execution “falls through” to the next step in the flow service. For example, in the following flow service, execution passes directly to the LogTransaction service if the value of PaymentType is “COD.”
An unmatched value will fall though the BRANCH
Keep the following points in mind when assigning labels to the targets of the BRANCH step:
*You must give each target step a label unless you want to match an empty string. For that case, you leave the Label property blank. For more about matching an empty string, see Branching on Null and Empty Values.
*Each Label value must be unique within the BRANCH step.
*When you specify a literal value as the Label of a child step, the value you specify must match the run-time value of the switch variable exactly. The Label property is case sensitive.
*You can use a regular expression as the value of Label instead of a literal value.
*You can match a null value by using the $null value in the Label property. For more information about specifying a null value, see Branching on Null and Empty Values.
*You can designate a default step for all unmatched cases by using the $default value in the Label property. For more information about using the $default setting, Specifying a Default Step.
Copyright © 2016 - 2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback