Solved

How to combine fn-Or and fn-And into a single expression

  • 22 September 2022
  • 3 replies
  • 168 views

Hi there. First time poster here and could use some help with an expression I'm working on.

 

Overall, I'd like to set the visibility of a control using an expression with multiple conditions - mainly the fn-Or and fn-And functions. The goal is to display Control1 if either of the following conditions are met:

-The current user is a member of SharePointGroup1 or is a member of SharePointGroup2

-Control2 equals a certain value and the form is in Display Mode

 

I've tried multiple iterations using only one SharePoint group but with no success. Could someone please take a look at the following code and tell me what I'm missing, as well as how to update the code so that it accounts for whether a user is a member SharePoint groups 1/2?

 

Sample Code for Control1's visible property:

fn-Or(fn-IsMemberOfGroup("SharePointGroup1"), fn-And(fn-Equals(Control2,"Value"), Is Display Mode))

 

Lastly, I'm using Nintex Classic (it's for a form that was previously created, so would prefer not to migrate it to the modern version). Thank you in advance.

icon

Best answer by MegaJerk 22 September 2022, 23:54

View original

3 replies

Userlevel 5
Badge +14

Rules execute when the conditional statement in them is true, so it might just be a matter of a little inversion.


 


try something like this:


fn-Not(
fn-Or(
fn-Or(
fn-IsMemberOfGroup("SharePointGroup1"),
fn-IsMemberOfGroup("SharePointGroup2")
),
fn-And(
fn-Equals(Control2,"Value"),
Is Display Mode
)
)
)

 


(note: you don't have to write it this way in your own environment, I've just broken it up this way so it might be more apparent how everything is working)


 


Visually, one might divide it like:



 


So if either one of those collections of statements you made previously are true, the value would be inversed (using that outer not statement) and the Control would be shown, otherwise, those checks return false, which inverted equals true, and the Control the rule is applied to is hidden. 


 


Clear as mud? 

Let me know if you need further help! 


 

Thank you for the detailed response. It helped put everything into perspective.


 


The code you provided didn't work as expected, however, I was able to modify it and the controls are now displaying as intended!!


 


Here is what ended up working:


fn-Or(fn-Or(fn-IsMemberOfGroup(SharePointGroup1),fn-IsMemberOfGroup(SharePointGroup2)),fn-And(fn-Equals(Control2,"Value"),Is Display Mode))


 


As you can see, I ended up having to remove the fn-Not function, as well as remove the quotes from the SharePoint group names. I'm not sure why the last part did the trick though.

Userlevel 5
Badge +14

I should have mentioned that my code was meant to be a generic example, but I am very glad that you were able to get everything working! Please mark your response as the solution to this problem! 

Reply