cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2196
Views
0
Helpful
11
Replies

workflow if/else example

joel.cason
Level 1
Level 1

I'm having trouble trying to integrate (what I think should be) a simple if/else statement in a workflow.  The documentation on this seems pretty lacking.

I created a new workflow called ifelsetest with a user input of catalog as "SelectOS".  I want to do an if/else based on if this input contains "Win."

So far every time either the if/else statement fails when it runs, or it always evaluates to false even when the Select OS category is something like "Window 2008".

What should the evalutation statement be to execute this?  If I try SelectOS contains "Win" it evaluates false.  I've also tried ifelsetest SelectOS contains "Win" which just fails to execute.

1 Accepted Solution

Accepted Solutions

Orf Gelbrich
Cisco Employee
Cisco Employee

Are you sure the variable contains words rather then a number and what does the exact statement look like you have I. The If Statement?

View solution in original post

11 Replies 11

Orf Gelbrich
Cisco Employee
Cisco Employee

Are you sure the variable contains words rather then a number and what does the exact statement look like you have I. The If Statement?

If I look at workflow properties, there is just the one input variable (catalog) and it is labeled SelectOS.  It actually had a space before and I deleted the space just to see. 

The exact if statement is:

SelectOS contains "Win"

And using this statement, if I select a catalog item like Windows 2008 it evaluates to false.

The cAtalog selections all result in numbers

Oh you may have been saying, am I sure that the contents of SelectOS are words and not a number?  No I'm not.  I'm choosing words from a list but maybe the actual content is some sort of ID number. 

Is it possible to debug or break to find out the value?

Try this? Variable is called out with ${}

$ contains “Win”

Patrick Horner

Systems Engineer

Sales / Channels

pahorner@cisco.com<mailto:pahorner@cisco.com> (epage)

Tel: +1 408 894 3613

CCIE - 13274

<sip:pahorner@cisco.com>[http://www.cisco.com/c/dam/m/en_us/signaturetool/images/icons/webex.png]<http://cs.co/patrickhorner>

Cisco Systems, Inc.

12515 Research Blvd., Building 3

78759 Austin

Texas

78759

United States

Cisco.com<http://www.cisco.com/>

Download vCard

Think before you print.

This email may contain confidential and privileged material for the sole use of the intended recipient. Any review, use, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message.

Preferences<http://www.cisco.com/offer/subscribe/?sid=000478326> – Unsubscribe<http://www.cisco.com/offer/unsubscribe/?sid=000478327> – Privacy<http://www.cisco.com/web/siteassets/legal/privacy.html>

Please click here<http://www.cisco.com/c/en/us/about/legal/terms-sale-software-license-agreement/company-registration-information.html> for Company Registration Information.

not sure why my email broke my reply...

try:

${SelectOS} contains "Win"

This gives the same result as not using the ${} notation.  It seems to always evaluate false.

Maybe it is true that the SelectOS variable actually contains some kind of numerical ID.  Is there an easy way to check what the value of this variable is while the workflow is executing?

Sr log

Yes in Sr log you can see the numbers or words selected or in the sr input output section

You were right.  I changed the input to admin input and selected the entry, and the output is actually a numeric ID so it wasn't matching up with the text.  I modified the match statement to the number and it worked fine.

Thanks!

Super cool.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Cisco UCS X-Series Energy Efficiency Offer