1

Can any one help me out to evaluate this expression at runtime using Vici parser.

I have tried other usual expressions like 5* VARIABLE kinda expression. But is it possible to evaluate conditional statements using VICI parser.

Example: IF SAL > 5 THEN 25 ELSE 45 ENDIF

Thanks...

Dhanasekar Murugesan
  • 3,141
  • 1
  • 18
  • 21
  • This structure is not possible. Probably we can use ternary operator {?:) so the expression can be given as : **(sal > 5 ? 25: 45)** But I am not sure, what do we do if we need a tree-structured coondition like if( sal > 7) then 3 else if( 10 > sal > 7) then 5 else 6 – Dhanasekar Murugesan Aug 10 '12 at 06:41

1 Answers1

0

You should use the ?: syntax:

SAL > 5 ? 25 : 45

You can expand this for multiple conditions as well:

SAL > 5 ? 25 : SAL > 10 ? 35 : 45
Philippe Leybaert
  • 168,566
  • 31
  • 210
  • 223
  • Thanks, Philippe. I got to know this but wanted this to be more readable. Since this needs to be entered by user. So, I don't want an user to know abt what language are we using. So asked. But thanks for your reply – Dhanasekar Murugesan Aug 30 '12 at 10:01