Evaluate multiple values in branch

Hi,
I am new to webMethods and using version 7. Trying to the build the flow to implement branch based on output value.

I’m getting the state abbreviation from the output document ( /stateid ) and if the stateid value is not ‘A’ or ‘B’ or ‘C’ then invoke service1 and for all others invoke service2.

Is it possible to implement using Branch and evaluate multiple values at once in the following sequence? :confused: If not what is the best approach? Please give me some suggestions on this, thanks in advance.

Here is my flow

Sequence
–Sequence (try)
----- Mapping
----- Branch on ‘/stateid’
----- Sequence: !=( “A” || “B” || “C” )
---------- service1
----- Sequence: $default ( for all other states )
---------- service2
–Sequence (catch)

Hi Nola,

If I understand your requirement correctly, You can do the following.

Branch
if (StateID!=‘A’ || StateID!=‘B’ || StateID!=‘C’ ) (use evaluate option)

or
default

Hope this helps.

Rookie4Webm

Hi Rookie4webM,

Thanks for the response.

Per your suggestion I used if condition in the 1st sequence step and when testing it is not evaluating the condition and directly jumping to $default sequence.

Here are the steps I was following to accomplish, let me know if anything is missing.

In Branch:
Switch = /folder1/subfolder2:docName/variableName ( in mycase variable name is StateID)
Evaluate labels = FALSE

In Sequence:
Label = if (StateID!=”A” || StateID!=”B” || StateID!=”C”’ )


For testing purpose when I specified just the value in the sequence label without any conditional statement it steps through the sequence flow and executes the service.
In Branch:
Switch = /folder1/subfolder2:docName/variableName
Evaluate labels = FALSE

In Sequence:
Label = A

Please correct if I’m not following the steps correctly, I’m new to this tool.

On the branch step set evaluate labels = true.

In the labels for your sub-branch-steps, you should mention,
%StateID%!=”A” || %StateID%!=”B” || %StateID%!=”C”’
or $default, whatever is appropriate

I suggest you to go through developer’s guide before starting any coding.

Just make the Evaluate Lables in Branch step to TRUE and leave the SWITCH value blank.
The rule here in BRANCH is,
if Evaluate Lables=TRUE then dont specify anything in SWITCH. Give only condition on the label of the child steps.
if Evaluate Lables=FALSE then specify the SWITCH variable and give the value in the label of the child steps.

Refer the document “webMethods Developer Users Guide 65.pdf” for more information. You can download it from the adavantage.webmethods.com website.

It’s working thank you all for your help and suggestions.

Another option is to use a regular expression. You can have a BRANCH on /stateID with Evaluate lables set to false and then set the label of the first step to: /A|B|C/ (or /^A$|^B$|^C$/ if you want to be exact - although with state codes the first expression would suffice.)

  • Percio