cancel
Showing results for
Did you mean:
Highlighted
Nintex Newbie

Show or Hide Panels by choice control answers

I'm hoping someone can assist me with looking at my rules.  I have series of 8 questions (all are answered with Yes or No).  Three separate panels will appear depending on how the questions are answered.  The first and second scenarios are easy.  If all the questions equal to "Yes" then show panel 1.  Here is the rule (this works).

 not(Med1=="Yes"&&Med2=="Yes"&&Med3=="Yes"&&Med4=="Yes"&&Med5=="Yes"&&Med6=="Yes"&&Med7=="Yes"&&Med8=="Yes")

Scenario 2.  If any of questions 1-6 equals "No", show panel 2.

 not(Med1=="No"||Med2=="No"||Med3=="No"||Med4=="No"||Med5=="No"||Med6=="No")

Scenario 3 is where I'm having issues.  Questions 1-6 have to equal "Yes" and either Question 7 or 8 can equal "No".

 not(Med1=="Yes"&&Med2=="Yes"&&Med3=="Yes"&&Med4=="Yes"&&Med5=="Yes"&&Med6=="Yes"&&Med7=="No"||Med8=="No")

Now, I'm real close.  My rule works perfectly if questions 1-6 are Yes and either 7 or 8 are "No".  However, If  you answer any one of 1-6 as "No" (panel 2 shows like it should) and answer 8 as "No" panel 3 shows up as well.  I've tried the rule with 1-6=yes and 7= no OR 1-6 =yes and 8=no, but doesn't work.  Hopefully someone can see into my logic to see what I'm missing.  Thanks

Labels: (1)

Tags (2)
10 Replies
Highlighted
Nintex Newbie

Re: Show or Hide Panels by choice control answers

Wouldn't you just want to break apart the not()

Maybe something like this:

```not(
Med1=="Yes"&&
Med2=="Yes"&&
Med3=="Yes"&&
Med4=="Yes"&&
Med5=="Yes"&&
Med6=="Yes"
) &&
not(
Med7=="No"||
Med8=="No"
)```

(I just broke out each line so it's easier to read.)

Highlighted
Nintex Newbie

Re: Show or Hide Panels by choice control answers

Try putting the "or" statement first instead of last:

Try rewrite your rule like this:

 or(not(Med8=="No"), not(Med1=="Yes"&&Med2=="Yes"&&Med3=="Yes"&&Med4=="Yes"&&Med5=="Yes"&&Med6=="Yes"&&Med7=="No"))
Highlighted
Nintex Newbie

Re: Show or Hide Panels by choice control answers

Unfortunately, this seems to unhide the panel when 1-6 are Yes.  It doesn't seem to matter what questions 7 and 8 are.

Highlighted
Nintex Newbie

Re: Show or Hide Panels by choice control answers

Doesn't work.  It will show the panel if 1-6 are "Yes" and 7 and 8 are "No". I tried doing the full formula to see if that would work, but it only works if 7 is "No".

 or(Med1=="Yes"&&Med2=="Yes"&&Med3=="Yes"&&Med4=="Yes"&&Med5=="Yes"&&Med6=="Yes"&&Med8=="No"), not(Med1=="Yes"&&Med2=="Yes"&&Med3=="Yes"&&Med4=="Yes"&&Med5=="Yes"&&Med6=="Yes"&&Med7=="No")

Highlighted
Nintex Newbie

Re: Show or Hide Panels by choice control answers

OK, I did some tests and think I have the answer for you:

1. remove the quotes

2. change yes to true and no to false

It is not a literal value and therefore should not be compared to a literal value inside "".

or(not(Med1==true&&Med2==true&&Med3==true&&Med4==true&&Med5==true&&Med6==true&&Med7==false, not(Med8==false))

Highlighted
Nintex Newbie

Re: Show or Hide Panels by choice control answers

@chanteldup, very good point. I didn't even thing to ask, if the Yes/No were boolean or choice fields.

@brianknight, what type of controls are the questions? Are they Yes/No checkboxes, or are they choice fields with Yes and No as options?

If they're boolean (Yes/No checkbox), you can even take it a step further. You don't even need the '==true'. With boolean, simply listing the variable name initiates the test for you.

i.e. not(Med1) is the same as asking not(Med1==true)

Which means @chanteldup's example:

```or(
not(
Med1==true &&
Med2==true &&
Med3==true &&
Med4==true &&
Med5==true &&
Med6==true &&
Med7==false
),
not(Med8==false)
)```

(I fixed missing closing parenthesis on the not() statement)

would turn into

```or(
not(
Med1 &&
Med2 &&
Med3 &&
Med4 &&
Med5 &&
Med6 &&
not(Med7)
),
Med8
)```

However, I still feel this isn't the correct grouping.

This code says that as long as Med8 is True, the entire equation equates to True, meaning the panel will hide.

In your initial question, you said:

Scenario 3 is where I'm having issues. Questions 1-6 have to equal "Yes" and either Question 7 or 8 can equal "No".

This leads me to understand you want to show Panel 3 when Questions 1-6 are all equal to Yes/True AND Questions 7 OR 8 are equal to No/False.

Is this a correct assumption?

If so, we need to create the negated rule for when to hide the panel, because that's how rules work. To do that, we can generally just wrap our test in a not() function, but we have to be careful with that. Additionally, we need to be careful in not mixing up our and()'s and or()'s, which I believe is what I did in my first suggestion.

To fix this, we need to test for the opposite, which means we want to hide the panel when any of Questions 1-6 are No OR Questions 7 AND 8 are Yes (because one of them must be No).

Here's my original suggestion ammended:

```or(
not(
Med1 &&
Med2 &&
Med3 &&
Med4 &&
Med5 &&
Med6
),
and(
Med7,
Med8
)
)```

In this code, the first section of the or() is testing each of the Med1 - Med6 variables. It will return True if any of the variables are false. And because this is in an or() function, only one test needs to be True for the entire thing to return True. So, if any of the Med1 - Med6 variables are false, the panel will hide.

In the second section of the or(), we're testing to see if Med7 AND Med8 are equal to true. If either of them are not, that will return false, BUT if both are true, the entire equation is true, meaning the panel will hide.

Please try this and let us know. Keep in mind, this is going off the assumtion that my understanding of when you want to show/hide the panel is correct.

Highlighted
Nintex Newbie

Re: Show or Hide Panels by choice control answers

Ok Wow, thank you for your help here.  First, to answer the first question these are setup as choice controls (not Yes/No checkboxes).  Panel three shows up when 1-6 == "Yes" and either 7 or 8 is "No".

The formula that I have that is closest to solving the issue is this one.

 not(Med1=="Yes"&&Med2=="Yes"&&Med3=="Yes"&&Med4=="Yes"&&Med5=="Yes"&&Med6=="Yes"&&Med7=="No"||Med8=="No")

It works pefectly when 1-6 are Yes and either 7 or 8 are no.  However the panel shows if any 1-6 are no and 8 is no.  If 7 is No and 8 is Yes, the panel hides like it should.  It needs 1-6 to be Yes.  Only 7 or 8 can be No. I know, I'm getting confused just writing this :).  Sorry,  I really wasn't all that clear about what exactly my problem was.

Nintex Newbie

Re: Show or Hide Panels by choice control answers

Ok, well that's certainly good to know that they're choice controls. In that case, you will need the =="Yes" portions to test for the string value.

```or(
not(
Med1 == "Yes" &&
Med2 == "Yes" &&
Med3 == "Yes" &&
Med4 == "Yes" &&
Med5 == "Yes" &&
Med6 == "Yes"
),
and(
Med7 == "Yes",
Med8 == "Yes"
)
)```

Here it is without all the separate lines:

`or(not(Med1 == "Yes" &&	Med2 == "Yes" && Med3 == "Yes" && Med4 == "Yes" && Med5 == "Yes" && Med6 == "Yes"), and(Med7 == "Yes",Med8 == "Yes"))`

I truly believe the problem you're having is because you're not properly grouping your tests. This should fix that.

Highlighted
Nintex Newbie