How to query the historical value of a DPE at a single, specified time in the past

Find and share HowTos to various installations / configurations!
2 posts • Page 1 of 1
MartinBoers
Posts:1
Joined: Thu Mar 06, 2014 11:58 am

How to query the historical value of a DPE at a single, specified time in the past

Post by MartinBoers »

Our application has a requirement to retrieve the value of an archived Data Point Element at a single, specified time in the past.

For example, a DPE may have the following values recorded in the Event archive:

Time Value
----------------------------------------------
2014.06.05 02:54:00.000 132.4
2014.06.05 04:12:00.000 189.0
2014.06.05 08:38:00.000 204.2

... and we may need to know what the value of the DPE was at 2014.06.05 06:00:00.000.

Currently, the only way I can get the value at 06:00 is something like the dpQuery:

SELECT '_original..value' FROM '{DPE}' TIMERANGE ("2014.06.05 06:00:00.000", "2014.06.05 06:00:00.001", 1, 1)

... and then figuring out what the value would have been at exactly 06:00 from the result set. The result set could contain 0, 1, 2, 3 or possibly more records.

Is there an easier way?

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: How to query the historical value of a DPE at a single, specified time in the past

Post by leoknipp »

Hello,

yes, there is an easier way.
You can use the function dpGetAsynch() to get the value for a specific time. A documentation for this function can be found in the online help.
When reading historical values normally the config _offline is read instead of _original. This is necessary to get the correct value. The value for _original.._value, _online.._value and _offline.._value can be different if a _default-value or a correction value is set.

For detailed information please have a look at
https://portal.etm.at/index.php?view=it ... &Itemid=54

Best Regards
Leopold Knipp
Senior Support Specialist

2 posts • Page 1 of 1