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 Apps
Answered

CountRows Function

(0) ShareShare
ReportReport
Posted on by 208

Dear All,

 

How can I set a variable based on the countRows value?

 

I would like that, on the Success screen to display a label that shows the number of the remaining rows from a gallery.

 

If I use the formula: CountRows(Gallery1.AllItems) I receive an issue: Inefficient delay loading.

 

Thank you!

 

Categories:
  • Verified answer
    RezaDorrani Profile Picture
    12,145 on at

    Hi @claudia ,

     

    That is a warning for performance. Since you are referencing a control (gallery) which is in a different screen, Power Apps will have to load both screens in memory. Better option would be to set it in a variable and then navigate to the success screen and use the variable.

    For more on performance, check  - https://youtu.be/_2jDGqtqqi8

     

    --------------------------------------------------------------------------------
    If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

    Thanks,
    Reza Dorrani, MVP
    YouTube
    Twitter

  • claudia Profile Picture
    208 on at

    Hi Reza,

     

    I have tried:

    1. create a global variable OnStart: set(varNoOfRows, CountRows(Gallery1.AllItems) .

    2 On Approve button: Patch(
    'LABELS - SUPPLIERS RAW MATERIALS',
    selectedItem1,
    {CheckedByIPRA: {Value: "Approved"}},
    {IPRAComments: DataCardValue7.Text},{ApprovalDate:Today()}
    );Notify("The label is approved"); varNoOfRows;Navigate(Success,ScreenTransition)

     

    On success screen: 

    Label Text: If (varNoOfRows>1, "There are more labels to be approved"°

     I think I am doing something wrong.

     

     

     

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

    @claudia 

    You would not want to be doing the formula you have in your OnStart.  In general, there is NO need to use a variable for any of this.

    Your final On success screen label text can simply be: CountRows(Gallery1.AllItems)

     

    Also, your Approve OnSelect action should be:

    Patch('LABELS - SUPPLIERS RAW MATERIALS',
     selectedItem1,
     {CheckedByIPRA: {Value: "Approved"},
     IPRAComments: DataCardValue7.Text,
     ApprovalDate:Today()
     }
    );
    
    Notify("The label is approved"); 
    Navigate(Success,ScreenTransition)

     

    I hope this is helpful for you.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 234 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard