Solved

Order of logic operations on a Run If action?

  • 26 October 2016
  • 8 replies
  • 36 views

Userlevel 5
Badge +13

I have a run if condition of If [ A AND B OR C]

 

According to both of these links: 

Logic operators 

Run If

 

That RunIf should evaluate to false if  is false. However, that's not the case I'm finding. I had a scenario where A was false, but B was true, and the run if evaluated to true and executed. After changing the order of the Run If conditions to be If [B OR C AND A] and the condition (with the same values as before and A still being false and B being true) evaluated to false. Why would this happen? This seems counter to the documentation. What are we missing? We've solved the "issue" by reworking our workflow, but I'm more interested in the "principle" of why this is functioning the way it is. 

icon

Best answer by xMikeX 27 October 2016, 03:27

View original

8 replies

Badge +3

GREAT question Courtney! I have this problem also!

Userlevel 5
Badge +12

I brought up this issue a long time ago on User Voice.   I think being able to use (    ) to surround statements would be helpful.   Vote up the issue here:  More Advanced Conditions in RunIf Action – Customer Feedback for Nintex 

Userlevel 5
Badge +13

Thanks, Mike! I gave it 3 votes on User Voice.

Userlevel 4
Badge +11

Hi Courtney Vargo‌,

how C was evaluated in your scenario?

if it was true, than it's right that the first condition was evaluated to true, because Nintex consider the order so first condition is equal to (A and 😎 or C while second evaluates as (B or C) and A

so, looking at a table with possible results (A is false and B is true like in your description), we have 

(A and 😎 or C(B or C) and A
A false, B true, C trueTrueFalse
A false, B true, C falseFalseFalse

Giacomo

Userlevel 5
Badge +13

C was false. B and C are evaluating the same field, just checking for different values. So it is something like this:

IF fieldA == value1 AND fieldB == value2 OR fieldB == value3, thus, B and C can not both be true at an evaluation.

Also, for your table with (A and 😎 or C with parameters A false, B true, C true, I don't believe you're correct that it should evaluate to True. Because your first check of (A and 😎 should be false because A is false, B is thus irrelevant because for that check to be true, A and B both must be true.

Userlevel 4
Badge +11

(A and 😎 is false, as you say, but subsequent evaluation state False OR True (C is True for that row) and it returns True because of C, if it was (A and 😎 and C, then all of them should be True in order to evaluate true all the condition.

Userlevel 5
Badge +13

Ahh, I was thinking as in our case when C is also false. However, agreeing with the poster above, parentheses would make this easier, because when I created the Run If I was thinking of it as A and (B or C) not (A and 😎 or C, which changes the logic.

Userlevel 4
Badge +11

Hi Courtney Vargo‌, if you consider the question as solved, could you mark one answer as correct?

Giacomo

Reply