Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I am attempting to use a function to iterate through 1 list and 1 column to perform an api call.
The function looks like this:
(agentID as text, dayDate2 as date) as table => let Source = Xml.Tables(Web.Contents("https://api.url.com/api/stats/agents/"& agentID &"/statistics?d=" & Date.ToText(#date(Date.Year(dayDate2),Date.Month(dayDate2),Date.Day(dayDate2)),"yyyy-MM-dd"))), Table0 = Source{0}[Table] in #"Table0"
The table calling the function looks like this:
let DateRange= List.Dates(#date(2019,01,01),365,#duration(1,0,0,0)), agentID = #"agent-id", Source = List.Transform(DateRange, each try {(_), #"2Params"(List.Transform(agentID,each _),_)} otherwise null), Table0 = Source{0}[Table] in #"Table0"
I've tried a bunch of iterations and different ways to get both parameters to the function but cannot seem to do so.
Any suggestions would be helpful.
Thank you
Hi @Anonymous ,
How about changing the code as below?
(agentID as text, dayDate2 as date) as table => let Source = Xml.Tables(Web.Contents("https://api.url.com/api/stats/agents/"& agentID &"/statistics?d=" & Date.ToText(#date(Date.Year(&dayDate2),Date.Month(&dayDate2),Date.Day(&dayDate2)),"yyyy-MM-dd"))), Table0 = Source{0}[Table] in #"Table0"
Unfortunately, it is not allowing me to enter that in the advanced editor, returning the error "expecting token literal"
I was under the assumption the issue is with my 'agent-id' list and how I am parsing it.
here is the associated error I am getting -
Expression.Error: We cannot apply field access to the type List. Details: Value=List Key=Table