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

Incorrect behavior of ‘==’ operator in IF() expression for Array typed variable #483

Closed
karimall72 opened this issue Jun 24, 2024 · 0 comments · Fixed by #488
Closed
Labels

Comments

@karimall72
Copy link

In IF() expression, operators made up of 2 characters behave badly for an Array typed variable :

EvaluationValue resultKO = new Expression("IF(TAB[1] == 2, 2, 0)")
                                                   .with("TAB", List.of(1, 2))
                                                   .evaluate();

This leads to the Exception: Unexpected token after infix operator
Same behavior for >=, <=

But simple = operator works fine:

EvaluationValue resultOK = new Expression("IF(TAB[1] = 2, 2, 0)")
                                                   .with("TAB", List.of(1, 2))
                                                   .evaluate();

And == operator works fine for “simple” variable:

EvaluationValue resultOther = new Expression("IF(x == 2, 2, 0)")
                                                       .with("x", 2)
                                                       .evaluate();

!= operator is not ok with Array:

EvaluationValue resultKO = new Expression("IF(TAB[1] != 2, 0, 1)")
                                                    .with("TAB", List.of(1, 2))
                                                    .evaluate();

This leads to the Exception: Undefined operator '!'
But it is OK for “simple” variable (x).

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

Successfully merging a pull request may close this issue.

2 participants