Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Gallery filter based on logged in user email address

(0) ShareShare
ReportReport
Posted on by 181

Hi.

 

I have an app which allows users to log their hours with a gallery where they are able to view (just the galley) the entries they have made.

 

On the Items tab of the gallery I've used the following coder to return the results unique to the logged in user:

 

 

LookUp(Hours, 'Email Address' = User().Email)

 

 

This did appear sort of work. As I'm testing this, I made 3 entries using using my AD Account and email address, when I refreshed the data source, only one item was showing in the gallery instead of 3.

 

I haven't had to make a gallery like this before so what am I doing wrong?

 

 

Categories:
  • Pstork1 Profile Picture
    66,015 Most Valuable Professional on at
    Re: Gallery filter based on logged in user email address

    That is a more efficient way to do it, but I didn't want to confuse you with the reference to app.onStart so I just did it in one line.

  • Angry_Sys_Admin Profile Picture
    181 on at
    Re: Gallery filter based on logged in user email address

    @Pstork1 Thank you for your solution. 

     

    I set the variable in the on OnStart properties for the app and then the filter on the gallery, all appears to be working. 

  • Verified answer
    Pstork1 Profile Picture
    66,015 Most Valuable Professional on at
    Re: Gallery filter based on logged in user email address

    Two potential issues with the code you are using.

    1) Lookup() will only return one record even if there are more than one that meet the criteria.  It always returns the first one it finds. You want to use Filter() not lookup().

    2) Using User() inside the statement will make it non-delegable so you'll never get all the entries if the list gets large.  But if you store the email in a variable and use that he statement is delegable.

     

    Use this instead

    Set(UserEmail, User().Email);Filter(Hours, 'Email Address' = UserEmail)

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,695 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,015 Most Valuable Professional

Leaderboard