Forum Discussion
bikelley
4 years agoHelper IV
How to create a custom dynamic list for REST API pagination?
Hello, I am trying to create a dynamic list that increments by 2000 until it meets the Total Result Count. Please see below for my initial API result. I have tried a few options and did ...
- 4 years ago
Hi bikelley
This code will create your list
let Source = Record.FromList({12958},{"TotalResultCount"}), TotalResultCount = Source[TotalResultCount], DynamicList = List.Generate(() => 2000, each _ < TotalResultCount, each _ + 2000), FinalList = List.Combine({DynamicList, {TotalResultCount}}) in FinalListI've set up a dummy record in the Source step so that I can simulate getting the TotalResultCount. You can modify this to suit your own query structure.
Regards
Phil
- 4 years ago
Hi bikelley
Change the FinalList step to this
FinalList = List.Combine({{1}, DynamicList, {TotalResultCount}})Regards
Phil
PhilipTreacy
4 years agoSuper User
Hi bikelley
Change the FinalList step to this
FinalList = List.Combine({{1}, DynamicList, {TotalResultCount}})
Regards
Phil
bikelley
4 years agoHelper IV
Thank you so much for your help and time.