Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Service refresh after pagination implementation with web data source

I am working on pagination implementation for my web data sources in PowerBI. However, I read in various places that using this kind of connection disables refresh from within the service (ie schedul...
  • v-lid-msft's avatar
    6 years ago

    Hi Anonymous ,

     

    It depends on the detail situation, you can upload it to Power BI Service and verify if it can configure scheduled refresh, we think if it does not work, the issue maybe  url is dynamic , you can try to  use following query which use query option to replace combine url manually, you can also use relative path, please refer to following document about query option and relative path: https://docs.microsoft.com/en-us/powerquery-m/web-contents

     

    let
        BaseUrl         = "https://XXXX/report?",
        Password           = "XXXX",
        Report           = "sales",
        Fields           = "",
        EntitiesPerPage = 1000,
        GetJson = (QParm) =>
            let 
                Options = [Headers=[ #"Authorization" = "Bearer " & Token ], Query = QParm],
                RawData = Web.Contents(BaseUrl, Options),
                Json    = Json.Document(RawData)
            in  Json,
        GetEntityCount = () =>
            let 
                QParm = [pw=Password,report=Report,count="true",per_page=Text.From(EntitiesPerPage)],
                Json  = GetJson(QParm),
                Count = Json[#"total_pages"]
            in  
                Count,
        GetPage = (Index) =>
            let 
                Page  = "page=" & Text.From(Index),
                QParm = [pw=Password,report=Report,page=Page,per_page=Text.From(EntitiesPerPage),fields=Fields],
                Json  = GetJson(QParm),
                Value = Json[#"data"]
            in  
                Value,
        PageCount   = GetEntityCount(),
        PageIndices = { 1 .. PageCount },
        Pages       = List.Transform(PageIndices, each GetPage(_)),
        Entities    = List.Union(Pages),
        Table       = Table.FromList(Entities, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
    in
        Table

     

    Please also consider the limitation of you api, it may block the request if they are too frequency or reach the api limitation (such as number limitation per day)


    Best regards,