"And Condition" and "Or Condition" together in a visibility component

Hey guys!
So it may sound silly!
Many of us might have faced this issue before!

We have an element that is to be visible by Role A or Role B and the signed in user should satisfy one more condition.

So the problem is:
Element Visibility is ((role = “Role A” or role = “Role B”) and verified = isChecked)
Any suggestions on how to achieve this!

P.S. I already have an answer, but this is somewhat of a challenge to the community!
I’ll post the answer in a day’s time and let the challenge be here till then!


Note: No computed columns to be added


My fallback would be to us a single IF column to return a true/false value for simplicity sake, and then use that for the visibility condition, since it is slightly more flexible than building a visibility condition.

But, since you threw out the challenge to not use any additional computed columns, I have a couple of ideas:

The first idea would require knowing all other potential roles (hoping that they remain fairly static and you don’t add new roles in the future).

So let’s say you have Roles A,B,C,D. I would structure the visibility conditions with AND, so all conditions must be true. This is how I would do it purely with a visibility condition and no computed columns.

IF Role != C
IF Role != D
IF verified = isChecked

The only problem is that it’s not scalable if new roles are added, so all visibility conditions would have to be updated each time a role is added that should not make the component visible.

The second idea, which is a lot simpler, is to structure your visibility condition like this:

IF Role is included in ‘Role A,Role B’
IF verified = isChecked

I’m leary about using ‘is included in’ or ‘includes’ only because of the potential for it to pick up unintended matches, but if you have good control over the potential values, then there shouldn’t be a problem.


The second idea is actually the perfect way to execute that!
Is included in works perfectly with arrays of information


Solution: https://media.discordapp.net/attachments/836261617028300800/1010970141435105290/AndOrConditionTogether.mp4

1 Like

Still curious if anybody else has other ideas. I’m always willing to learn. :slightly_smiling_face:


More interesting is that you can use any character/symbol as “separator” and the logic still works… WTF! :upside_down_face:

I mean, theses cases/syntaxes can be used:

IF Role is included in ‘Role A/Role B,Role C’
IF verified = isChecked

… or this one

IF Role is included in ‘Role A Role B; Role C’
IF verified = isChecked

but there will be problems if our logic finds a match on some string (the Jeff´s concern).
If you have these Roles names: Admin, Admin-EN, Admin-SP and Full Admin

the logic bellow will fail because the Admin word is contained in these 4 cases:

IF Role Type is included in ‘Admin’
IF verified = isChecked

but anyway, it’s good tip if we do all this very carefully and don’t use words with similar letters.


As fas as I’m concerned, the if-then-else column solution is the best, and the one I will always use once I have more than a single condition. It’s the easiest to maintain - especially if the condition needs to be applied to multiple components - and it doesn’t violate my personal mantra of keeping as much logic as possible in the data editor.

I agree with your comments regarding the is included in option. I consider that fragile and easily broken, and I would avoid it.


This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.