Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Lina_B
Regular Visitor

Issue with pagination for airtable (no records)

Hello,

 

I tried to apply the pagination formula to obtain more than 100 records from airtable in the power query. Unfortunately, the pagination does not work and I have no more records (I have the names of all the columns but no records (1 record = null). I tried several times with the different formulas found in the forum, but it finds no records. 

 

The formula I used in the Advanced Editor, using my Table, App and Key ID, is as follows: 

 

 

 

let
    Pagination = List.Skip(List.Generate( () => [Last_Key = "init", Counter=0], // Start Value
           each  [Last_Key] <> null, // Condition under which the next execution will happen
           each [ Last_Key = try if [Counter]<1 then "" else [WebCall][Value][offset] otherwise null,// determine the LastKey for the next execution
                       WebCall = try if [Counter]<1 then Json.Document(Web.Contents("https://api.airtable.com/v0/[APP_ID]/[TABLE_ID]", [Headers=[Authorization="Bearer [KEY_ID]"]]))
                        else Json.Document(Web.Contents("https://api.airtable.com/v0/[APP_ID]/[TABLE_ID]?offset="&[WebCall][Value][offset])), // retrieve results per call
                   Counter = [Counter]+1// internal counter
                      ],
           each [WebCall]
    ),1),
 
    #"Converted to Table" = Table.FromList(Pagination, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
in
#"Converted to Table"
 
 
 
Thank you for your help!
1 REPLY 1
PhilipTreacy
Super User
Super User

hi @Lina_B 

I'm a little unclear on the results you are getting.  You say you have no more records, and you have the names of all the columns but no records, yet you say you have 1 record = null?

Maybe if you shared an image of your actual results it would be clearer to me.

Using your code below to connect to my own Airtable account I successfully retrieve data.

Have you tried confirming that your API call below is actually returning data?  You can issue a request directly in your browser like this

 

 

https://api.airtable.com/v0/BASE_ID/TABLE_ID?api_key=keyXXXXXXXXXX

 

 

 Phil


If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors