TP7
Novice

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

Jump to solution

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.

Labels: (1)
0 Kudos
Reply
3 Replies
MegaJerk
Collaborator

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

Jump to solution

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:

MegaJerk_0-1663883527441.png

 

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! 

 

0 Kudos
Reply
TP7
Novice

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

Jump to solution

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.

0 Kudos
Reply
MegaJerk
Collaborator

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

Jump to solution

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! 

0 Kudos
Reply