1

I'm trying to evaluate an expression using NCalc.

iif(fval(hopo_pfd)="true",fval(hopa_basic)*12%,0)

But this expression is producing an error

no viable alternative at input ',' at line 1:46

All functions declared here are custom functions. But the event EvaluateFunction is not even raised. Please help.

Soham Dasgupta
  • 5,061
  • 24
  • 79
  • 125

1 Answers1

1

I believe you have invalid syntax. The expression: fval(hopa_basic)*12% includes the modulo % operator, but you haven't provided a divisor.

If you meant 12 percent, then it should be written in a decimal format: fval(hopa_basic)*0.12.

The reason it hasn't attempted to call EvaluateFunction to call your custom functions is because it failed to parse your expression syntax, let alone get to the stage of executing/resolving custom functions.

Chris Sinclair
  • 22,858
  • 3
  • 52
  • 93