Branching on an Expression :
When you branch on an expression , you assign an expression to each child of a branch step. At run time , The BRANCH step evaluates the expression assigned to the child steps. It excutes the first child step with an expression that evaluates to true.
To Branch on an expression :
1.Create a list of the conditional steps (target steps) and make them children of the BRANCH step.
2 In the Properties panel for the BRANCH step, set Evaluate labels to True.
3 In the Label property of each target, specify the expression that, when true, will cause the target step to execute. The expressions you create can include multiple variables and can specify a range of values for variables. Use the syntax provided by webMethods to create the expression. For more information about expression syntax, see Appendix D, “Conditional Expressions”.
* only one step will be executed .
* To define a default step , write $default in the label property of the default step.
Branch to Null or Empty ?
Branch
on |
When
to use it ? |
how ?
|
Null
|
if the switch variables is
explicitly set to null or does not exist in the pipeline. you can use $null with any type of switch variable |
set label property to $null
|
Empty
|
if the switch variable is present but
contains no characters . you can use it with type string only. |
leave the label property blank
|
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, the server ignores target steps with a blank or $null label.
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, the server ignores target steps with a blank or $null label.
example :
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.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
Important!
You can only have one default target step for a BRANCH step.
Developer always evaluates the default step last. The default step does not need to be the last child of the BRANCH step.
Developer always evaluates the default step last. The default step does not need to be the last child of the BRANCH step.
If you want to use the value of a pipeline variable for this property, type the variable name between % symbols (e.g. %expression%).
No comments:
Post a Comment