Creating a pagination variable

CONTEXT
I’d like to create a make scenario where I’m pulling data from an API (CRM) and adding it to a google sheet. The pagination is page-based. (I pass the page variable as a parameter)

ISSUE
In the payload, there is no “total_pages” variable. All I have to work with is the following:
totalResults
resultsPerPage (capped at 25)

To get a “total_pages” variable I’d do something like “totalResults”/“resultsPerPage”

How do I get this to work? Is what I suggested the best approach?

Thanks!
Dimitri

Welcome to the Make community!

You got the right idea. You’ll just need to use the built-in function ceil to round up the number of pages.

e.g.:

{{ ceil( 1.totalResults / 1.resultsPerPage ) }}

For more information, see the function documentation in the Help Center and do the tutorials in the Make Academy.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.