cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
theisogunro
Helper IV
Helper IV

Hide tabs if not an Admin

I have 3 tabs and I want the last two tabs to be non-visible if the current user is not an Admin.

Here's the formula I'm using: 

If(And(!isUserAdmin,Or(ThisItem.Label="Government", ThisItem.Label="Team"), false,true), false, true)

 

In the image below, the current user is not an admin as indicated in the label under the date.

theisogunro_1-1638980465600.png

 

I've had different variations of the formula but just can't get it to work properly.  any help would be much appreciated.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@theisogunro 

So then modify that Items property to:

Filter(
    Table({ID:1, Label:"Request"},
          {ID:2, Label:"Government"},
          {ID:3, Label:"Team"}
    ),
    isUserAdmin || !(Label in "Government|Team")
)

 

Or, a little cleaner and more flexible...

Filter(
    Table({ID:1, Label:"Request", Visible:true},
          {ID:2, Label:"Government", Visible:isUserAdmin},
          {ID:3, Label:"Team", Visible:isUserAdmin}
    ),
    Visible
)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

5 REPLIES 5
RandyHayes
Super User
Super User

@theisogunro 

Filter them out in your Items property, not in the gallery itself.

What is your Items property of your gallery?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

It's just a table

Hi @RandyHayes 

items: 

 Table({ID:1, Label:"Request"},{ID:2, Label:"Government"},{ID:3, Label:"Team"})

 

RandyHayes
Super User
Super User

@theisogunro 

So then modify that Items property to:

Filter(
    Table({ID:1, Label:"Request"},
          {ID:2, Label:"Government"},
          {ID:3, Label:"Team"}
    ),
    isUserAdmin || !(Label in "Government|Team")
)

 

Or, a little cleaner and more flexible...

Filter(
    Table({ID:1, Label:"Request", Visible:true},
          {ID:2, Label:"Government", Visible:isUserAdmin},
          {ID:3, Label:"Team", Visible:isUserAdmin}
    ),
    Visible
)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

WOW! Genius.  Thank you so much!!

SwathiVepuri
Frequent Visitor

@RandyHayes Thank you soo much. It helped me to resolve.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (1,369)