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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Is there a difference between parameters created in the UI and parameters written into a function?

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
    Source

And 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
Source

I'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!

2 REPLIES 2
v-eachen-msft
Community Support
Community Support

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.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
Anonymous
Not applicable

@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.BI Screenshot.PNG

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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