问题
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.
回答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.
来源:https://stackoverflow.com/questions/18534450/ncalc-evaluation-error-no-viable-alternative-at-input