0

Loading Data from Multiple Pages for CallRail

Hi Klipfolio Gurus,

I have been trying to load data from multiple pages dynamically and use it in one klip only from CallRail API

I have read this great post where you have answered in detail and also this one with more explanations - however, I am still facing issues in loading datasets through Callrail API in certain steps within it.

My problems are as follows:

1. How many data sources are you finally loading in the klip? Static or dynamic or both of them? 

2. Where is the final query with "MAP" exactly added?

3. How to make sure MAP reads all rows of all datasets - currently, it shows up only same data or reads it only 4 times etc as shown below?

My formulae and the state currently - it's only showing 4 values when I divide by 250 or if I use "total_records" - it just repeats the same data for total number of rows or shows up 4 times.

Note: $page = 2 and both static and dynamic datasources are added in this klip for now.

 

 

2 comments

  • 1
    Avatar
    Adam Doogan-Smith

    Hi There!

    Thanks for reaching out. To answer your questions, I have detailed the answers below:

    1. When working with dynamic data sources, you will only need to create one data source. Once the data source is set-up correctly this data source will create a new data source instance for each page of data. If you are using CallRail the parameter that is needed for pagination is called "page". In addition, the max amount of records you can pull per page is 250 and can be defined with the per_page parameter. 

    The dynamic data source query will look like this:

    https://api.callrail.com/v1/calls.json?per_page=250&company_id=<company_ID>&page={props.page}

    Be sure that before you execute this query, you create the "page" variable in your klip editor and give it a valid default value; for example 1. 

    2. The MAP/MAPFLAT formula you have in your above image is current except for one point. $page needs to be written as "page".

    3. The formula is reading the page four times right now because the second parameter of the MAP/MAPFLAT needs to have the variable wrapped in quotations as mentioned above. Once this change is made, the formula should return data from all four pages.

    Also, it is important to note the distinction between MAP and MAPFLAT. MAP will only return the first value from each page which is why you see only four values when you evaluate the formula. Conversely, MAPFLAT returns all calculated values per page. 

    If you have any further questions about this, don't hesitate to ask and we'll be more than happy to help you further!

    -Adam

  • 0
    Avatar
    Michael Wagner

    Great, i love your support! It works for me!

Please sign in to leave a comment.