Pagination: condition on iterated item count for variably sized pages (can't use page size ✕ page count)

Is there a way to use the total number of already-iterated items in the pagination.condition conditional?

Specifically I don’t know the page size until I’ve already made my first query, so my first page is going to be an assumed default value, and the API isn’t guaranteed to return that count. It will return a page size value that is to be used for the remaining pages presently, which might change based on load or the air speed velocity of swallows (laden and/or unladen).

So, is there a pagination property that already tracks the number of items we’ve iterated… and it is not the page size multiplied by the page count? If yes, I missed it and would appreciate being led in the right direction!

It wouldn’t matter all that much, but I need to request from the API exactly the right number of pages with as few pages as possible and then on the last page, I need to request exactly the correct number of items to reach the item count limit as specified via the scenario/user. I already do this in other custom apps… but those aren’t variably-sized pages, so that’s trivial. And just to speak clearly, I can’t simply use the pagination.limit since I have to be precise in the number of items are returned in the final page… it’s an API/operations count issue on the other end that I have no control over.

Thanks for any help you can provide on this! :grin:

Hey Emmaly!

Predicting the average velocity of swallows can indeed be very hard, especially when you need to account also for the aerodynamic drag according to the number and disposition of swallows in the flight. :thinking:

If this works for you, it’s the simplest solution: you can perform the first API call and check if the “pageCount” or “totalResults” parameter (or whatever it’s called) exists in the response. If it always returns the page count/total results when there’s more than one page, just use a repeater to paginate normally and then aggregate the results. Finally merge the first array with the second with, well, the merge function.

If your API doesn’t provide a “total count”/“page count” value even when there are more pages, then we’re talking cursor-based pagination or something of the sort (or perhaps a “less-than-great” API). In that case, I would recommend…


It can be tricky, but brew yourself a cup of your preferred beverage and check out this video to see how the idea works in Make:

Just adapt it to your use-case and you should be set. :wink:

I hope this points you in the right direction!

edit: you can develop your own custom app instead as well. That would definitely use fewer operations so depending on the total number of results you have it might be a better option. You can find the pagination limits for custom apps here.

1 Like