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.
Hello all!
I have a request to a webservice that returns an authorization token: fnAuthorization. I use List.Generate function to iterate function to get different tokens, but when I call fnAuthorization or update data, Fiddler show that power bi makes only one request to the service and return one token in all rows.
Does anyone know how to force power bi to make several requests of the same type instead of one? I will be glad for any help.
Result
let
result = List.Generate(
() => [i=0, res=fnAuthorization()],
each [i]<10,
each [i=[i]+1, res=fnAuthorization()],
each [res]
),
#"Converted to Table" = Table.FromList(result, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandTableColumn(#"Converted to Table", "Column1", {"SessionId"}, {"SessionId"})
in
#"Expanded Column1"
fnAuthorization
let
Source = () => let
data = Json.FromValue([Login="",Password=""]),
headers = [#"accept"="application/json; charset=utf-8", #"Content-Type"="application/json"],
web = Web.Contents("url", [ Content = data, Headers = headers, ManualStatusHandling = {404, 400}]),
result = Json.Document(web),
#"Converted to Table" = Record.ToTable(result),
#"Pivoted Column" = Table.Pivot(#"Converted to Table", List.Distinct(#"Converted to Table"[Name]), "Name", "Value")
in
#"Pivoted Column"
in
Source
I don't know at all the subject and the environment of API calls and WEB accesses, but I am interested in following the discussion.
In the meantime, I would be curious to know the result of a test that I cannot do.
you could adapt this code to your case with your function instead of f (x) and see if this "bypasses" the effect of caching
let
lf=List.Repeat({f},10),
result = List.Generate(
()=> [i=0, res=lf{i}(i)],
each [i]<10,
each [i=[i]+1, res=lf{[i]}(i)],
each [res]
),
f=(x)=>x+1
in
result
let
lf=List.Repeat({f},10),
result = List.Generate(
()=> [i=0, res=lf{i}()],
each [i]<10,
each [i=[i]+1, res=lf{[i]}()],
each [res]
),
f=()=>"get token"
in
result
the idea (probably naive) is to make believe (I don't know who or what) that they are functions call different, while instead they are the same call
Here's a simplified version. See if that can get around the cache issue. @ImkeF Any suggestion on how to avoid caching?
let
Source = List.Generate(()=>0,each _<10,each _+1),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Invoked Custom Function" = Table.AddColumn(#"Converted to Table", "SessionId", each fnAuthorization())
in
#"Invoked Custom Function"
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.