JeffGrant
Well-known Member
- Joined
- Apr 7, 2021
- Messages
- 558
- Office Version
- 365
- Platform
- Windows
Hi All,
I have a requirement to loop the following code through the past 120 days. When I do this manually, everything works fine. However, I need to run this for the last 120 days. I could sit at my PC and changed the system date 120 times, but I figure there must be a better way and I can also expand my learning.
I am thinking that the "Result" would be the accumulation of all of the downloaded data.
How would I structure this code to achieve this? There is a lot more to this code, that is not pasted here.
// URL constants
Today = Date.ToText(Date.From(DateTime.LocalNow()), [Format="dd-MMM-yyyy"]),
// API Loop
TableFromJson = Table.AddColumn(WithRaceNumbers, "Json", each
let
URL = BaseDomain & "/GetFormHistorical/" & [Track] & "/" & Text.From([RaceNumbers]) & "/" & Today & "?ApiKey=" & APIKey,
Result = Json.Document(Web.Contents(URL))
in
Result
),
thanks in advance
I have a requirement to loop the following code through the past 120 days. When I do this manually, everything works fine. However, I need to run this for the last 120 days. I could sit at my PC and changed the system date 120 times, but I figure there must be a better way and I can also expand my learning.
I am thinking that the "Result" would be the accumulation of all of the downloaded data.
How would I structure this code to achieve this? There is a lot more to this code, that is not pasted here.
// URL constants
Today = Date.ToText(Date.From(DateTime.LocalNow()), [Format="dd-MMM-yyyy"]),
// API Loop
TableFromJson = Table.AddColumn(WithRaceNumbers, "Json", each
let
URL = BaseDomain & "/GetFormHistorical/" & [Track] & "/" & Text.From([RaceNumbers]) & "/" & Today & "?ApiKey=" & APIKey,
Result = Json.Document(Web.Contents(URL))
in
Result
),
thanks in advance