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