NCalc evaluation error no viable alternative at input ','

删除回忆录丶 提交于 2019-12-11 06:19:21

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!