Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

Evaluating multiple conditions on an if statement in workflow

$
0
0

Simple one but it's driving me nuts. How can I evaluate multiple conditions as part of a single if statement?

 

my code looks like this:

if (element.getAttributeWithKey(key).value !=="" || element.getAttributeWithKey(key).value != 0 || element.getAttributeWithKey(key).value != null){

.... rest of workflow script here

}

 

My values are coming from a configuration element and I basically want to check whether the value of a particular attribute from that configuration element is not empty, zero or null so that I can ignore the attribute in that case.

 

If I split the if/or statement into three individual if statements one after the other my code works as I want it to do, ignoring attributes with an empty/zero or null value, but when combined into an or statement the workflow doesn't function as expected and doesn't ignore the attributes with an empty/zero or null value.

 

Can anyone point out where I am going wrong?

 

I have tried

if ((element.getAttributeWithKey(key).value !=="") || (element.getAttributeWithKey(key).value != 0) || (element.getAttributeWithKey(key).value != null)){

also

if ((element.getAttributeWithKey(key).value) !=="" || (element.getAttributeWithKey(key).value) != 0 || (element.getAttributeWithKey(key).value) != null){

without success.

 

Shouldn't make a difference but this is in vRO 6.0


Viewing all articles
Browse latest Browse all 6251

Trending Articles