Forum Discussion

rsderby68's avatar
rsderby68
Icon for Resolver I rankResolver I
3 years ago
Solved

Help Trying to use RelativePath to update published Power BI Report.

Hello, I have a published Power BI report that pulls data from a Web/API.  Following all kinds of help videos I set it up get paginated results from the API by creating a page function and then a List.Generate code (see below).  However I just found out that my published report will not schedule update because it is pulling from an API/web.  

 

I need to figure out how to get this report to update/schedule refresh.  From what I have read, this would require changing my orginal function (below) to use something called RelativePath, which I don't fully understand.  I followed the instructions I read, but the updated function (also, below) when ran with the list.generate started creating new functions and got stuck trying to pull from the API.  Something is wrong. 

 

Could someone help me rewrite this to properly use relativepath so I can update my awesome published report?  

 

List Generate (for paginated results)

= List.Generate(()=>

[Result = try fCustomers(1) otherwise null, Page=1],

each [Result]<>null,

each [Result = try fCustomers([Page]+1) otherwise null, Page=[Page]+1],

each [Result])

 

Original Function

= (Page as number)=>

let

    Source = Json.Document(Web.Contents("https://api.vhx.tv/customers/?page="&Number.ToText(Page))),

    _embedded = Source[_embedded],

    customers = _embedded[customers]

in

    customers

 

RelativePath Function

= (Page as number)=>

let

    Source =

Json.Document(Web.Contents("https://api.vhx.tv/customers/",

[RelativePath="?",

Query= [

Page="?&Number.ToText(Page)"]])),

    _embedded = Source[_embedded],

    customers = _embedded[customers]

in

    customers

  • I figured it out finally.  You have to play around with RelativePath and there seems to be a lot of variance in how it is used.  

2 Replies