Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.
Retrieving Historical Values
-
I would like to retrieve the historical values stored via cron/meta-data point that are run once an hr and per month for a chart. When I perform a mysql query, I get what I expect. e.g. if there are 5 entries I get 5 entries.
MySql query returns what I expect.
e.g.select pointValue, from_unixtime(ts/1000) from pointvalues where datapointid=474
via ma-point-values I get the 5 + a current value which is the same as the last log value. I am using these to seed a chart and always get an extra point that mirrors that of what was saved via cron.
<ma-point-values point="point1" values="point1Values" from="dateBar.from" to="dateBar.to" rollup="{{dateBar.rollupType}}" rollup-interval="{{dateBar.rollupIntervals}} {{dateBar.rollupIntervalPeriod}}"> </ma-point-values> <p>There are {{point1Values.length}} rows to display.</p> <md-table-container> <table md-table> <thead md-head> <tr> <th md-column>TimeStamp</th> <th md-column>Point Value</th> </tr> </thead> <tbody md-body> <tr ng-repeat="value in point1Values"> <td md-cell>{{value.timestamp | maMoment:'format':'ll LTS'}}</td> <td md-cell>{{value.value}}</td> </tr> </tbody> </table> </md-table-container>
This is an output on the per month points. I don't want the Dec 3 to return. mySql only has the 1 entry.
-
@chrapchp The extra point values you are seeing are "bookend" values that are added at the start and end of the time period you are querying over. These are inserted for ease of charting.
The
<ma-point-values>
component always fetches these bookend values, there is no option to exclude them. I will add in an attribute so you can choose to exclude them for the next UI module release.In the meantime, you can remove the first and last elements of the array using
values.slice(1, -1)
or write your own component in a user module. -
Thanks. It will probably end up a user component.
pjc
-
@chrapchp here's the commit where I added the bookend attribute for reference - https://github.com/infiniteautomation/ma-dashboards/commit/4180be9742aa02017e869c96a5b5c3d8097d3e92