web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Gallery filter based o...
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:
I have the same question (0)
  • Verified answer
    Pstork1 Profile Picture
    69,573 Most Valuable Professional on at

    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)
  • Angry_Sys_Admin Profile Picture
    181 on at

    @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. 

  • Pstork1 Profile Picture
    69,573 Most Valuable Professional on at

    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.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 352 Most Valuable Professional

#2
11manish Profile Picture

11manish 192

#3
Valantis Profile Picture

Valantis 128

Last 30 days Overall leaderboard