Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing error with field having hyphen sign. #79

Open
nrmohta opened this issue Feb 23, 2017 · 0 comments
Open

Parsing error with field having hyphen sign. #79

nrmohta opened this issue Feb 23, 2017 · 0 comments

Comments

@nrmohta
Copy link

nrmohta commented Feb 23, 2017

Hi,
I am facing parsing error when field name in expression is having hyphen sign.
Example expression - field-plus+field-minus
variables - field-plus and field-minus
Objective - I want to perform addition of these 2 variables.

My code

Map<String, Double> map = new HashMap<>();
map.put("field-plus", 5d);
map.put("field-minus", 10d);
Expression e = new ExpressionBuilder("field-plus+field-minus" )
.variables("field-plus","field-minus")
.build()
.setVariables(map);
double result = e.evaluate();

Its throwing - Unknown function or variable 'field' at pos 0 in expression 'field-plus+field-minus'
I have also tried option to use single quote character in expression like "'field-plus'+'field-minus'" and setting variable with single quote but still it gives error to parse single quote character.

Is there any other way to achieve my goal ? If its a defect , is there any plan to fix it ?
Please suggest.

Thanks,
Neeraj.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant