Skip to main content
Nintex Community Menu Bar

validation only evaluating part of expression

  • December 6, 2016
  • 4 replies
  • 12 views

Forum|alt.badge.img+6

I have a custom validation that is only evaluating part of the expression. It's attached to a choice control (dropdown) 

If I chose 

And a value from the second dropdown

The validation will be successful

If I chose 

And a value from the second dropdown, the control will fail the validation regardless if a value is selected or not

4 replies

Forum|alt.badge.img+14
  • Scholar
  • December 6, 2016

1. javascript's '&&' operator has higher precedence over '||'.

so, 2nd and 3rd expressions are first ANDed and result then ORed with1st expression in your formula.

I feel you wanted first OR to be evaluated and then result ANDed to 3rd expression.

2. to check for control emptiness use rather isNullOrEmpty() runtime function


Forum|alt.badge.img+6
  • Author
  • December 6, 2016

Hi Marian,

I have tried the following with the same results

And


Forum|alt.badge.img+14
  • Scholar
  • December 6, 2016

you have reordered single expressions but you haven't changed evaluation logic at all.

your formula should look like (simplified)

isNullOrEmpty(SSMP) && (MEO == 'Family' || MEO == 'Adult')

note parentheses there to force OR evaluate before AND.

from logic point of view it doesn't matter whether you put && before or after parentheses.


Forum|alt.badge.img+6
  • Author
  • December 6, 2016

this resolved the issue

is there a reference for the order of rules and logic?