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

Gallery pagination

(0) ShareShare
ReportReport
Posted on by 1,346

Good day everyone.

 

Is the below article from @hpkeong still the best way to do pagination on galleries?

https://powerusers.microsoft.com/t5/General-Discussion/Useful-features-of-PowerApps-16-Pagination/td-p/11968

Categories:
I have the same question (0)
  • dinusc Profile Picture
    Microsoft Employee on at

    Hello Dawidvh,

     

    Yes. For now I don't think there's a better way. The formulas however will not work on Flexible Height galleries.

  • Brian Dang Profile Picture
    3,976 on at

    Hi @DavesTechTips,

    It's good to see @hpkeong's solutions still helping folks. I agree--LastN(FirstN()) is probably the best here.

     

    Let me try designing another solution if you'd like one anyway. I am thinking my old solution for overcoming the 500 record limitation can help with pagination. I stopped using it since I can retrieve all my records via flow and boost the delegation limit, but its concepts might be helpful here.

     

    For my scenario, I have a primary key that is an integer. Every row has a sequential number. Because of this setup, I can determine the identity of the first record, the last record, and find out how many pages would be needed by subtracting their primary keys and dividing by the number of records I want to show on each "page."

     

     

    Set(firstrecord, First(datasource));
    Set(lastrecord, First(Sort(datasource,PrimaryKey,Descending)));
    Set(maxpages, RoundUp((lastrecord.PrimaryKey-firstrecord.PrimaryKey)/500,0))

    Change 500 to the amount you want on each page. I normally set it to a slider's value, so I can change the amount.

     

    Create icons to page through--disable them if they reach the first page or the last page. I use a variable to increase/decrease the current page.

     

    Set(page,page+1)
    Set(page,page-1)

     

    Next, you'll collect or bind a gallery to a filter that shows rows where the primary key is within the range:

     

     

    Filter(datasource,
     PrimaryKey>=firstrecord.PrimaryKey+(page-1)*500,
     PrimaryKey<firstrecord.PrimaryKey+(page)*500
    )

     

    This means, "Filter the datasource where the primary key is between the interval for the selected page. The lower bound is determined by starting at the first record and compensating for how many pages have been passed. The upper bound is determined by starting at the first record and compenssating for if you were to add the size of the interval." 

     

    You can probably use a variable to store the minimum primary key and maximum key in the range since it's going to be a constant anyway.

     

    Limitations

    My solution can show the number of records in the chosen interval (500 in my case). However, since it relies on the primary key, if you've deleted records, you will not get a full interval on each page. FirstN and LastN would be better suited for retrieving a consistent amount.

     

    Let me know if this helps.

     

    Brian

     

  • RezaDorrani Profile Picture
    12,143 on at

    Hi @DavesTechTips ,

     

    I was working on a scenario with a customer on gallery pagination. Key requirement was delegation. All current pagination techniques run into delegation issues or use of collections.

     

    I have tried a technique that allows pagination with delegation.

    Let me know your thoughts.

    https://www.youtube.com/watch?v=aKsNOsGj72A

     

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

  • RezaDorrani Profile Picture
    12,143 on at

    Hi @mr-dang 

     

    I was working for a customer with a similar request but delegation was a key factor. Their SP list has over 5k records.

    I covered my workaround in my latest video. I would love to know your thoughts.

    https://www.youtube.com/watch?v=aKsNOsGj72A

     

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

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard