• Recent
    • Tags
    • Popular
    • Register
    • Login

    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.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Find datapoint value from one week ago

    Scripting general Discussion
    2
    3
    1.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • richard.mortimerR
      richard.mortimer
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • CraigWebC
        CraigWeb
        last edited by

        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 --> maPointStatistics

        you 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

        1 Reply Last reply Reply Quote 0
        • richard.mortimerR
          richard.mortimer
          last edited by richard.mortimer

          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

          1 Reply Last reply Reply Quote 0
          • First post
            Last post