Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Code for Filtering Gallery By User does not show error but it doesn't show records either.

(0) ShareShare
ReportReport
Posted on by 228

Why is this code not rendering any results when there are records that I have created.

Filter( 'NEST Intake System', 'Created By'.Email=varUser)

 

ShondaT_0-1678321570363.png

 

 

Categories:
  • ShondaT Profile Picture
    228 on at
    Re: Code for Filtering Gallery By User does not show error but it doesn't show records either.

    @mmollet  I have been so impressed about the responsiveness of everyone here! It really makes developing these apps all the more enjoyable when you have a community of equally passionate people willing to share their knowledge.

     

    As an update: I've been asked now to filter that gallery on a people/group field that allows for more than one person. I'm leaving the exploration of that to tomorrow. I don't know how I'm going to get that to happen! LOL

     

    Thanks again for all of your help!

  • mmollet Profile Picture
    3,187 on at
    Re: Code for Filtering Gallery By User does not show error but it doesn't show records either.

    Glad to hear it! This forum/community is actually incredibly nice and badass in many ways! Im on here all the time just to help b/c its enjoyable. 😛 Good luck with the app!

  • Verified answer
    ShondaT Profile Picture
    228 on at
    Re: Code for Filtering Gallery By User does not show error but it doesn't show records either.

    @mmollet After posting my update I decided to try to use the Requestor field rather than the created by field that seemed to do the trick. I even extended it to include the work type colulmn which was the ultimate goal:

     

    Filter('NEST Intake System', Requestor.DisplayName=User().FullName && 'Work Type'="NCA")

     

    Thank you so much. Our dialogue was very helpful!

  • mmollet Profile Picture
    3,187 on at
    Re: Code for Filtering Gallery By User does not show error but it doesn't show records either.

    Have you tried just make a new screen and dropping in a gallery. Just delete everything out of it and add a textbox or 2 with the important data so you know what it is showing is correct such as wherever you are storing the user name. Then set the items property to the code I sent previously and see if it works on a more simple gallery. If it does then you can be sure that it isnt that code. I have a gallery here that is working with the filter I provided but the set up and other parts are obviously not the same as what you have. When I get stuck like this I generally try to start from the most basic element and then add functionality until I figure out what the issue is. 

     

    To check what is stored in 'Created By' you could always go into the list settings for that list and then show that column and see what value it has. When I did this it just had Full Name of the user stored in it. 

     

    Also NP! I am going to do my best to get this resolved today just hang in there 🙂

  • ShondaT Profile Picture
    228 on at
    Re: Code for Filtering Gallery By User does not show error but it doesn't show records either.

     

    @mmollet You are correct! That's exactly what I'm trying to do.

     

    It doesn't seem to like the "=". I get the red squiggly.

     

    I tried doing 'Created by'.FullName=User().Fullname) just for kicks. "Fullname for Created By doesn't even appear as an option like "email" does. 

     

    When the code appears to be error free, it just comes back with "We didn't find any data."

     

    I've also tried the code on my "Requestor" column which autopopulates with the current user's name as a result of the following code added to the DefaultSelectedItems of the DataCardValue:

    If(NCAForm_1.Mode = FormMode.New, {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", Claims:Concatenate("i:0#.f|membership|",User().Email), DisplayName:User().FullName, Email:User().Email}, ThisItem.Requestor)

     

    Maybe something in that code can help identify a possible solution?

     

    By the way thank you so much for your time and really wanting to help me figure this out. 🙂

     

     

     

  • mmollet Profile Picture
    3,187 on at
    Re: Code for Filtering Gallery By User does not show error but it doesn't show records either.

    We will figure it out for sure! 

     

    First I want to confirm that I understand what you are needing. 

    You have a gallery that is linked to a SP list?

    You want to only show items in that gallery that the current user created?

     

    Also I believe that CreateBy returns the FullName not the Email now that I am looking at it so first you should try:

    Filter('NEST Intake System','Created By'=User().FullName)

    Im hoping that just fixes it. Sorry for bad info yesterday!

  • ShondaT Profile Picture
    228 on at
    Re: Code for Filtering Gallery By User does not show error but it doesn't show records either.

    Thanks @mmollet. I tried your code: Filter('NEST Intake System','Created By'.Email=User().Email)

     

    and it's still rendering no results. When I inspect user() it shows me and my email address. Nothing comes up when I select Created By.

     

    ShondaT_0-1678375423652.pngShondaT_1-1678375432654.png

    When I add the Created By field to my form and remove the filter so all records show, my name appears in the field.

     

    I am really at a loss and I have to get this done today. 😞

  • mmollet Profile Picture
    3,187 on at
    Re: Code for Filtering Gallery By User does not show error but it doesn't show records either.

    Try:

    Filter('NEST Intake System', 'Created By'.Email=User().Email)

     

    Make sure to not have a ';' after this statement as for some reason when I tested this it threw an error. Very weird that it does so imo. Also Created By and User().Email shouldn't need the to lower function as they are both set by the system and in both cases are grabbed from the same variable from the user. The only way I can see this being an issue is if you recently changed the email from the admin center or something and now they arent the same.

     

    Also check your text inputs in your gallery and see what the error is on each of those. The gallery isnt throwing an error but the controls inside of it are. Makes me think seeing that might be of some help in getting this solved.

     

    Another thing you can do is to highlight just the 'Created By' and see what that variable is holding then highlight the User().Email and see that they match. If so then you can be sure that this string comparison isn't the issue. 

  • ShondaT Profile Picture
    228 on at
    Re: Code for Filtering Gallery By User does not show error but it doesn't show records either.

    @BCBuizer  I've revised my response to your response.

  • ShondaT Profile Picture
    228 on at
    Re: Code for Filtering Gallery By User does not show error but it doesn't show records either.

    @BCBuizer 

     

    My bad on that...I did added it and there's the delegation issue but it's still not rendering any results. I've tried both ways and they continue to render no results. I'm just throwing everything at it that I can think of. 

     

    ShondaT_1-1678321147343.png

     

     

    Here's what happens without the change:

    ShondaT_3-1678321241605.png

     

     

     

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,702 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