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 / Count Gallery Rows fro...
Power Apps
Unanswered

Count Gallery Rows from Home Screen before Navigation

(0) ShareShare
ReportReport
Posted on by 14

Hi!

 

In my App I want to count certain rows in my gallery 'BrowseGallery' (all records, number of active records etc..) on the Home Screen however my Gallery is contained in a subsequent Browse Screen.

 

I'm trying to get around the fact that I want the items to display when a user first opens the App (so the app won't of navigated to the Browse Screen at this point). What I've tried so far will only work once the navigation to the Browse Screen has taken place. 

 

Examples of a couple of approaches so far: 

-Creating a collection OnVisible in the Home Screen, then counting that - 

CountRows(SMCollection)
 
- Counting the Gallery direct 
CountRows(Filter(BrowseGallery1.AllItems, IsBlank(Resolved)))

 

I did try to count the List items instead but can't seem to work around the Delegation Warning when I count all records and also don't seem to be able to select specific columns just the list itself. 

 

I feel like there's something simple I'm missing! Could anyone please help? - Sorry the apps I've built previously have always been very basic and I'm trying to get a bit more clever with approaches! 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,024 Most Valuable Professional on at

    Hi @BeccaSarah ,

    To work around (possibly partially) the Delegation issue - put your gallery Items where shown.

    With(
     {
     _Data:
     Filter(
     YourGalleryItemsHere, 
     Resolved = Blank()
     
     },
     CountRows(_Data)
    )

    How many records do you expect with Blank() in resolved. Also please post your Gallery Items (in Text) 

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • BeccaSarah Profile Picture
    14 on at

    Thanks @WarrenBelz for replying! 

     

    I've used your expression, had to change slightly: 

     

    With(
       {
          _Data:
          Filter(
             BrowseGallery1.AllItems,
             IsBlank(Resolved)
          )
    },
       CountRows(_Data)
    )
     
    This has worked a treat without the delegation warning - thank you! However its still showing as 0 when I first start the app and only changes once I've gone to the Browse Screen and back to Home.
     

    Right now the Resolved number is low but eventually could reach the 100s or 1000s long term 

     

    Gallery Items I'm trying to count: 

    - All rows 

    - Active Records: 

    CountRows(Filter(BrowseGallery1.AllItems, IsBlank(Resolved)))

     

    "Resolved" is currently a date field 

     

    - Active Records with a particular request type:

    CountRows(Filter(BrowseGallery1.AllItems, And(StartsWith(RequestType.Value, "Inc"), IsBlank(Resolved))))
     
    Thank you for your help! 
  • WarrenBelz Profile Picture
    153,024 Most Valuable Professional on at

    @BeccaSarah ,

    What is the Items of BrowseGallery1 (in text please as per my previous post). If you are going to run this at App OnStart, you need to query the actual data source, not the gallery. Also note that if querying a data source directly, Resolved = Blank() is Delegable whereas IsBlank(Resolved) is not.

  • BeccaSarah Profile Picture
    14 on at

    I'm sorry I misunderstood this! - Its 'Service Management' 

  • james1994 Profile Picture
    229 Moderator on at

    Just wanted to add that it's not ideal to count the gallery directly as it only loads 100 rows at a time. This means if your gallery is > 100, you'll only see 100 items in your count. As you would have done your count on a gallery in another screen, this means it'll only count up to 100 items.

  • BeccaSarah Profile Picture
    14 on at

    Thanks @james1994 . I hadn't realised that, sorry if a daft question but is this the same for filtering the gallery IE it'll only show the first 100 matches? 

  • WarrenBelz Profile Picture
    153,024 Most Valuable Professional on at

    @BeccaSarah ,

    That is why I noted you need to filter the data source and not the gallery - you will only initially get 100  records. Put 'Service Management' where I have YourGalleryItemsHere

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 793 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 333 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard