Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

filter gallery by user and admin

(0) ShareShare
ReportReport
Posted on by 395

Hi, i have a gallery with a sharepoint data source and currently have the items of the gallery filtered so that user can only see what they created. However, i would also like to add an additional email address so that this user would be able to login and see all entries in the gallery. i thought maybe something like If(User().Email=user@bbb.com, true, Filter(KBXoffline, 'Created By'.Email = User().Email)

I currently have this in the items;
Filter(KBXoffline, 'Created By'.Email = User().Email)

 

Kind regards,
Matt383   


Categories:
  • Matt383 Profile Picture
    Matt383 395 on at
    Re: filter gallery by user and admin

    Thanks, that works

  • Verified answer
    PowerRanger Profile Picture
    PowerRanger 3,458 on at
    Re: filter gallery by user and admin

    @Matt383

     

    Yes you need double quotes. If you want more than 1 mailaddress the approach is somewhat different

     

    You have to use

    Set(varMyAdminEmail, ["mail1", "mail2" ])

     

    And the formular would be a "in" instead "="

    If(User().Email in varMyAdminEmail.... 

     

     

    Sorry it is somewhat difficult to write the complete Formular on a. Mobile so I have to shorten it

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Matt383 Profile Picture
    Matt383 395 on at
    Re: filter gallery by user and admin

    Thanks for your solution, Just when i put in the email, it has an expected operator error on the email. Do i need to wrap the email in double quotes?

  • Matt383 Profile Picture
    Matt383 395 on at
    Re: filter gallery by user and admin

    Thanks, do i need to use double quotes around the email. Just getting an error without them  Set(varMyAdminEmail, "foo@foo.de") also to add additional users do i just use  Set(varMyAdminEmail, "foo@foo.de";"newuser@foo.de")

  • Jeff_Thorpe Profile Picture
    Jeff_Thorpe 6,085 on at
    Re: filter gallery by user and admin

    I am very slow at typing. This is the second time I started to reply to a post with no response and when I finished my reply I see someone had already responded a minute or two earlier (and with a better answer). Sorry @PowerRanger , I don't mean to step on your responses. 

  • Verified answer
    Jeff_Thorpe Profile Picture
    Jeff_Thorpe 6,085 on at
    Re: filter gallery by user and admin

    If you only have one admin that would but you would need to change true to KBXoffline. If you have more than one admin you might want to create a variable onStart called IsAdmin and set it to true if the the current user is part of your admin list.

     

    If(User().Email=user@bbb.com, KBXoffline, Filter(KBXoffline, 'Created By'.Email = User().Email)

    or 

    If(IsAdmin, KBXoffline, Filter(KBXoffline, 'Created By'.Email = User().Email)

  • PowerRanger Profile Picture
    PowerRanger 3,458 on at
    Re: filter gallery by user and admin

    @Matt383

     

    So you want to show all items for a particular user

     

    Use this in the Items property

     

    If(User().Email = varMyAdminEmail, KBXoffline, Filter(KBXoffline, 'Created By'.Email = User().Email))

     

    Place this somewhere else like OnStart

     

    Set(varMyAdminEmail, foo@foo.de)

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard