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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (4,784)