Hi Erwin,
The last value of the variablePricesAndRenewables subset isn't always the value we require - we need the period for the half hour increment which is the last one tagged as periodType":"ACTUAL"
.. this will change depending on the time of day. The variablePricesAndRenewables subset contains half hour increments for the day. The point where the tags change from ACTUAL to FORECAST changes based on the time of day that we pull the data.
Is there a way to scan the JSON data values within the variablePricesAndRenewables subset to find the last one tagged with periodType":"ACTUAL" rather than the last one in the subset?
Kind Regards
James
Hi,
Further to my last message I've added the following code to return the last period of type ACTUAL
Thanks for your help
The last value of the variablePricesAndRenewables subset isn't always the value we require - we need the period for the half hour increment which is the last one tagged as periodType":"ACTUAL"
.. this will change depending on the time of day. The variablePricesAndRenewables subset contains half hour increments for the day. The point where the tags change from ACTUAL to FORECAST changes based on the time of day that we pull the data.
Is there a way to scan the JSON data values within the variablePricesAndRenewables subset to find the last one tagged with periodType":"ACTUAL" rather than the last one in the subset?
Kind Regards
James
Hi,
Further to my last message I've added the following code to return the last period of type ACTUAL
Code:
for i,k in ipairs(mydata.data.variablePricesAndRenewables) do
if (k.periodType == 'ACTUAL') then
wholesaleKWHPrice = k.wholesaleKWHPrice
end
end
Thanks for your help