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 / Hide gallery if User()...
Power Apps
Answered

Hide gallery if User() LookUp returns blank

(0) ShareShare
ReportReport
Posted on by 588

My app records a staff member's training record, and I want them to be able to come back and edit their record at any time.

 

At the moment, I have a 'Start' button which Navigates a new user to a NewForm, shown in the red box below. This works all good.

newformstart.png

I have a second button which you can see in the bottom left of the screenshot above, which is a Gallery with the Items being:

 

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

 

This means if a user has already submitted a record it shows that record, and then it navigates to the EditForm. This works by itself too.

My problem is trying to get the Gallery to hide when the lookup returns blank. I have tried a couple of different suggestions noted below, all with no luck.

 

1) Setting visible property of Gallery to:

 

If(IsBlank(LookUp(MatrixResponses,
User().Email = 'Email Address')), false, true)

 

which I believe should mean, if the lookup returns blank (as in, there is no matching email address), do not show the gallery. This returns true however even when the SharePoint list is completely empty

 

2) Setting the visible property of the gallery to:

 

CountRows(Gallery1.AllItems) = 1

 

This is also showing the gallery, even when the SharePoint list is completely empty

 

My plan is to layer the buttons on top of each other, and have the NewForm button visibility set to 

 

If(Gallery1.Visible = true, false, true)

 

so if there is not a previous record the user makes a new one. 

 

Am I missing something obvious? Is there an easier way to do this?

Categories:
I have the same question (0)
  • Verified answer
    Pstork1 Profile Picture
    69,481 Most Valuable Professional on at

    IsEmpty works against a string, but Lookup() returns a record.  So your original formula for the visible property will work if you add a string field that will contain a value for each record retrieved.  Title is usually a good choice since it is a simple text field and is required by default.  So your formula should read

    If(IsBlank(LookUp(MatrixResponses,
    User().Email = 'Email Address').Title), false, true)

    I would also save the user's email to a variable onStart and use that instead of the call to user().Email.  Both will work, but getting the user's email once is better than doing it every time the screen is displayed.

  • joeinmay Profile Picture
    205 on at

    On the visible property of the gallery:

    If(IsEmpty(Gallery1.AllItems),false,true)

  • misc Profile Picture
    588 on at

    Thank you - and to @joeinmay  for both your quick responses! It's always those little bits which throw me out 🙂 I ended up going with Pstork1's answer but only because it was the first one I read.

  • joeinmay Profile Picture
    205 on at

    the early bird catches the worm 😁

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 834

#2
Valantis Profile Picture

Valantis 533

#3
Haque Profile Picture

Haque 410

Last 30 days Overall leaderboard