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 an Icon based on ...
Power Apps
Answered

Hide an Icon based on Count Rows in a Gallery

(0) ShareShare
ReportReport
Posted on by 3,291

Hi there,

I would like to hide an icon based on this formula:

 

CountRows(Gallery1.AllItems) = 0

So this means if the gallery is empty the icon won't be visible.

 

The problem is: In my gallery I have some fields that the default = "false" or "true"

But there is no data in my gallery. And still showing the icon as visible.

 

How can I skip this?

 

Thanks in advance

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @sajarac 

    If you have any records in your Gallery, then the count will not be 0.

    What you will want to do is filter out certain records in that gallery.

    i.e. CountRows(Filter(Gallery1.AllItems, <criteria>)) = 0

     

    Just replace the criteria with what you want to filter on about those rows in the gallery.

     

    I hope this is helpful for you.

  • Sajarac Profile Picture
    3,291 on at

    OMG, you are 24/7

    As always thank you very much for your prompt response.

     

    I don't have any records in my gallery but some fields are showing i.e false   or   true and I guess the formula is counting those are records.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @sajarac 

    I'm actually an AI Robot!!  LOL  I could use a couple of those though!!

     

    Well, if something is showing in your Gallery, then it has to have records.  Otherwise it would be blank.

    Now, when I say something showing - that is in Play/preview mode...not in design mode.

    In Design mode you will see the template of the Gallery always.  In play/preview, you will see the template for each record in your items.  So, again, if you see something in play/preview, then there HAS to be records in your gallery Items.

     

    Confirm what you are seeing based on that statement.

  • Sajarac Profile Picture
    3,291 on at

    OK. How Do I know that you are not a Bot?  😀

     

    In edit mode I see the template and 3 fields with a value of false in a record that I know is empty.

     

    Now switching to another record that has some values I see the same but when I hit play/preview I see nothing. 

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @sajarac 

    "Invalid Input!!"  <in robotic voice>

     

    Okay, so if you see nothing in play/preview, then that means there is nothing.

    So, let's explore...

    What is the Items property of your Gallery?

  • Sajarac Profile Picture
    3,291 on at

    Is :

    Filter (myDatabase, ReqID = Gallery1.Selected.ReqID)

     

    And inside there is a HTML Label

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @sajarac 

    Confusion sets in!!!

     

    In your original formula you were trying to count the rows of Gallery1

    BUT, you are stating that your Items property is based on a record Selected in Gallery1 - that is not valid.  You should be getting a circular reference error on that.

  • Sajarac Profile Picture
    3,291 on at

    sajarac_0-1642542971113.png

     

    sorry sorry, let me send you some screen shots 

     

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 846

#2
Valantis Profile Picture

Valantis 532

#3
Haque Profile Picture

Haque 410

Last 30 days Overall leaderboard