Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I have a function that lists parameters and then uses them to paginate/offset an api query when invoked. This works fine, but I want to set them up so that I can adjust the parameters without invoking the function and creating a new query/dataset everytime. So, I set the same parameters up using the UI but now my pagination does not work.
I'm wondering if there is some key difference between the two types of parameter, or more likely, what I'm missing that is causing it to break.
Here is the code that works;
let
Source = (maxrecords as number, limitoffset as number, Token, optional query) =>
if query = null or query = ""
then List.Generate(
()=>[Counter = 0],
each [Counter] < maxrecords,
each [Counter = [Counter] + limitoffset],
each Json.Document(Web.Contents("'URL'/api?limit=" & Number.ToText(limitoffset) & "&offset=" & Number.ToText([Counter]), [Headers=[ContentType="application/json", Authorization="Bearer " & Token]])))
else List.Generate(
()=>[Counter = 0],
each [Counter] < maxrecords,
each [Counter = [Counter] + limitoffset],
each Json.Document(Web.Contents("'URL'/api?limit=" & Number.ToText(limitoffset) & "&offset=" & Number.ToText([Counter]) & "&" & query, [Headers=[ContentType="application/json", Authorization="Bearer " & Token]])))
in
SourceAnd this code (with the parameters set through the UI) only returns a single page of data.
let
Source = if query = null or query = ""
then List.Generate(
()=>[Counter = 0],
each [Counter] < maxrecords,
each [Counter = [Counter] + limitoffset],
each Json.Document(Web.Contents("'URL'/api?limit=" & Number.ToText(limitoffset) & "&offset=" & Number.ToText([Counter]), [Headers=[ContentType="application/json", Authorization="Bearer " & Token]])))
else List.Generate(
()=>[Counter = 0],
each [Counter] < maxrecords,
each [Counter = [Counter] + limitoffset],
each Json.Document(Web.Contents("'URL'/api?limit=" & Number.ToText(limitoffset) & "&offset=" & Number.ToText([Counter]) & "&" & query, [Headers=[ContentType="application/json", Authorization="Bearer " & Token]])))
in
SourceI'm sure there's something I'm just not seeing, but I thought it would be worth checking to see if there is some fundamental difference between the two types of parameter that is causing an issue.
Thanks for taking a look!
Hi @Anonymous ,
You could check if the parameter is decimal number in UI. After my tests, both of the methods could finish the cycle. So I think the problem is caused by parameter properties in UI.
@v-eachen-msft Thanks for testing it. I've tried them as Any and as Decimal Number and still no luck. My UI doesn't seem to have an option for just plain Number.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.