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
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (4,229)