Can you do If..Else..Or.. in Expressions


I was wondering if you can do something similar to...
<#if(<#myTable.**>="Hello" Or <#myTable.**>="GoodBye"; dosomething; dosomething)>
Or similarly
<#if(<#myTable.**>="Hello"; dosomething;dosomething)>
I know you can get similar results using nested ifs, but this can get ugly.

You can use any Excel function in the condition of the if, and this includes OR and AND. For example, you can do:
<#if(OR(<#myTable.**>="Hello"; <#myTable.**> = "Goodbye"; you can use more than 2 oORs)="GoodBye"; dosomething; dosomething)>

Now, no matter what, complex expressions can get ugly. What I normally do is to break them in expressions.

Say for example, define an expression "Test" to be OR(<#myTable.**>="Hello"; <#myTable.**>="Goodbye")
and then write.

<#if(<#Test>; dosomething; dosomething)>

You can go down this as much as you want or makes sense. Test could also be made from other simpler expressions, and you can even use parameters in expressions (see the demo in "Expression parameters")

Ps: About the second thing, the "Elseif" I am not sure I undestood it. Else is already in the if
so the elseif in your example would never be called.
You could write

but again, if you are going to nest a lot, expressions can help keep this simpler.

Adrian Gallero2012-02-14 17:58:00

Thank you, this should help me alot.  As far as the else if stuff, I understand there's an else section part, but nexting a bunch of if's in there can be nasty.  But I like what you did with the <#test> part, definatly going to use that.

Thanks Alot!