Find datapoint value from one week ago
-
Hi,
We have some data I'm displaying on a dashboard for several sites, which includes fuel tanks - whilst I can get the instantaneous reading of a single fuel tank (displayed as a % full, using
<ma-point-value flash-on-change="true" point-xid="DP_812852"></ma-point-value>
), is it possible to get the data point value from one week ago?The reason is to compare how much the tank has drained over a week to see the general usage and see whether they require to be refilled ...
Thanks
Richard
-
Hi Richard
You will want to read this help document here: https://help.infiniteautomation.com/mango-rollups-and-statistics
You should also read over the<ma-point-statistics point="myPoint" from="from" to="to" statistics="statsObj"> </ma-point-statistics>
API documents which can be found at API Docs ---> components --> maPointStatisticsyou will also probably need to use maNow to use dynamic from and to values on the maPointSatistics
Where your 'to' value will be now and you 'from' value will be now minus 7 days -
Thanks, I've got the following code which displays the current time, and one week ago:
<ma-now update-interval="1 SECONDS" output="time"></ma-now> {{ time }}<br /> {{ time | maMoment:'subtract':7:'days' }}
but I'm not sure how to put it in the statistics part, the following fails:
<ma-point-statistics point-xid="DP_349842" from="time" to="time | maMoment:'subtract':7:'days'" statistics="statsObj"></ma-point-statistics>
as does wrapping it in braces, am I following the right syntax?
[edit]
Looks like I had the right syntax (albeit with the dates the wrong way around):
<ma-point-statistics point-xid="DP_349842" from="time | maMoment:'subtract':7:'days'" to="time" statistics="fuel1"></ma-point-statistics>
The issue was with the value I was selecting:
(Last week: {{ fuel1.minimum.value }})
is correct(Last week: {{ fuel1.average.value }})
is not ....Cheers
Richard