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

Notifications

Announcements

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
    68,717 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
    68,717 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard