Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everybody , I need to write an if statement with multiple conditions for example :
if(enter_time+exit_time) >= 2, count(vhcls) .
is there an if formula to do this or should I use another function?
many thanx.
You can use as many condition as you want, but typically the if statement is inside aggregation:
count(if((condition1 or condition2) and (condition3 or condition4) and condition5, vhcls))
the syntax is
IF(Cond,TrueExpression,FalseExpression)
where Cond can be
ExpressionA AND|OR ExpressionB AND|OR ExpressionC and so on
Thank you. I mean could I use variables inside an if statement ? If so what's the syntax ?
Many thanx.
You can use variables.
Syntax - it depends what's the content of the variables, and how you're going to use them. It could be a value, for example your '2' in the opening post can be replaced with a variable. Or it could be the whole condition, or its part. If you want a more specific answer, upload your application.
maybe you meant
if(enter_time>= 2 AND exit_time >= 2, count(vhcls))
?
regards
Marco
If there are 2 expressions in the fasle expression how to write it?
Can you tel some example?
Count(if((enter_time+exit_time) >= 2,vhcls)
vMyVariable=(enter_time+exit_time)
Count(if($(vMyVariable)>2,vhcls)
Please open a thread for your questions instead of adding them to existing ones.
thanks
regards
Marco