I have a digital tag that I want to compute how long it has been in the current state.
Imagine data like this:
I have this equation to try to measure how long 'tag' has been either ON or OFF.
if 'tag' = "ON" then '*'-FindNE('tag', '*', '*-2d', "ON") else '*'-FindNE('tag', '*', '*-2d', "OFF")
The problem is that the FindNE is returning the time when the tag first was not equal to the state, not the last moment.
For example, FindNE('tag', '*', '*-2d', "ON") executed at 16:17 returns 2016-04-28 16:00 when I really want it to return 2016-04-28 16:07:59.
What can I do to get the last time a value was true?
(and FindNE('tag', '*', '*-2d', "OFF") executed at 16:17 returns 2016-04-28 16:17 (current time) so it is not helpful; FindEQ(... "ON") returns the same, of course)