Page 1 of 1
how can i know the time of the latest data in history?
Posted: Tuesday 29 January 2019 22:28
by papoo
Hello,
I am trying to force refresh a record in history if it is older than one day.
How to do that simply?
MyVar.getLatest().time return a table, not a time
Re: how can i know the time of the latest data in history?
Posted: Tuesday 29 January 2019 22:38
by papoo
i found in doc
rawDate
rawTime
Re: how can i know the time of the latest data in history?
Posted: Tuesday 29 January 2019 22:40
by waaren
papoo wrote: Tuesday 29 January 2019 22:28
Hello,
I am trying to force refresh a record in history if it is older than one day.
How to do that simply?
MyVar.getLatest().time return a table, not a time
for Lua (and therewith for dzVents) time is a table.
Re: how can i know the time of the latest data in history?
Posted: Wednesday 30 January 2019 11:09
by Toulon7559
Have been struggling with the same aspect, but not yet found a simple answer.
See
viewtopic.php?f=61&t=18582&p=159686&hil ... ty#p143230
Re: how can i know the time of the latest data in history?
Posted: Thursday 31 January 2019 9:24
by waaren
papoo wrote: Tuesday 29 January 2019 22:28
Hello,
I am trying to force refresh a record in history if it is older than one day.
How to do that simply?
MyVar.getLatest().time return a table, not a time
This should do it
Code: Select all
return {
on = { timer = {" every minute"}},
data = { testValue = { history = true, maxItems = 1 }}, -- Only one record in history
execute = function(dz)
-- initialize persistent historical data (only needed once)
if dz.data.testValue.getLatest() == nil then
dz.data.testValue.add( "initialized")
end
if dz.data.testValue.get(1).time.daysAgo > 0 then
dz.data.testValue.add("refreshed at " .. dz.time.rawDate .. ", " .. dz.time.rawTime)
end
end
}