Solved

Hide Show Rules for Panels

  • 21 July 2021
  • 5 replies
  • 327 views

Badge +3

I recently inherited a form where their panel rules are not working. I am not a rule expert and was hoping for some assistance. 

 

I need the panel to show whether the form is "In Process" or it is "Approved". 

 

The current rule is:

not({ItemProperty:Approved}==True) || not({ItemProperty:CompApproval}="In Process")

 

If I separate the two into different panels the rule works but when I have them together it doesnt work. 

 

Not sure why the OR statement is not registering. Any help would be much appreciated. 

icon

Best answer by bgarvey 22 July 2021, 17:11

View original

5 replies

Userlevel 1
Badge +8

try:
and({ItemProperty:Approved}!=True, {ItemProperty:CompApproval}!="In Process")
your pipes are producing an "or" statement. For rules you have to think in the negative. In your scenario if both of them are true, you want it to hide the panel.


 


Setting the logic in separate Rules is equivalent to using an "and" statement.


 


In your formula, if either one of the statement is true, the panel will be hidden.  What you want is for them both to be true (hence the and) for the panel to be hidden.


 


Since you say you are new to rules, here are a few tips:


value a == value b is the same as equals(value a, value b)


value a != value b is the same as not(equals(value a, value b))


the and & or functions only allow evalutating two items such as and(value a!= "", value a!="value b") - to extend you must nest like and(and(value a!= "", value a!="value b"), value c!="")


 


And finally, for some rules you have a choice between "Item Properties" and "Named Controls".  If you want the panels to show or hide dynamically while the user is in the form filling it out based upon selections (very valuable for "guiding" the user), use Named Controls.  If you want the panel to be show or hidden and not change during the form edit based upon user changes, then use Item Properties which is referring to the values stored on the list item at time of form load.


 


Rules should always allow Named Controls, but other control settings due not.

Badge +3

Thanks for the reply and info. So my panel needs to show in both stages of the approval process. So if it is "in process" or if it has been approved. If I make it an "and" statement it wouldnt show at the correct phases cause both statements would not be true. That is why I was going with the "or" statement. 


 


 

Userlevel 1
Badge +8

I believe you are still thinking in the positive.


The rule:


and({ItemProperty:Approved}!=True, {ItemProperty:CompApproval}!="In Process") then Hide


 


responds to these scenarios:


Approved = True regardless of value of CompApproval; resolves to False, panel is shown


CompApproval = In Progress regardless of value of Approved; resolves to False, panel is shown


Approved != True AND CompApproval != In Process; resolves to True, panel is hidden


 


so the "positive" description of the rule above would be:


if approved is True or CompApproval is In Progress, show the panel

Badge +3
This did work and much appreciated. I was thinking if I did an "and" statement both would have to be true.

Thanks.
Userlevel 1
Badge +8

That is correct, both parts need to resolve to true in order to Hide the panel.


 


The hardest thing when I started with rules, and sometimes I still struggle with, is the use of "and" vs "or" does not feel intuitive.

Reply