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

"maximum time" and "minimum time" syntax for Analog Statistics object in Metadata scripts


  • Does anyone know the proper syntax for the Analytics Object "time" functions in the metadata source in Mango 1.12.0? Does it work? When I use the following syntax, I get no error messages, but ALWAYS 0.0 as a result.

    return pxxxx.past(DAY, 30).maximum.time

    The idea is to find the time at which the maximum value occurred in the past 30 days. Any help would be appreciated

    Craig


  • Try maximumTime.

    return pxxxx.past(DAY, 30).maximumTime


  • Thanks for the quick response Matt. Tried that with the same result ("Success. result=0.0"). .maximumTime, .maximumtime, .maximum_time, and .maximum.time all give that same response, but if I give a known bad (.maximum time or .time.maximum for example) I still get a script error (type errors or other).

    Confused.

    Craig


  • Note that you can return the stats object from your script and click the test icon if you want to see all of the attributes that it has. No need to guess about the attribute names.

    The maximumTime attribute may be 0 if there were no values during the interval. What is the value of the "count" attribute?


  • Thanks Matt,

    That was the info I needed to figure it out. I didn't realize I could apply the "help" to drill down. I put in the following script:

    return p1164.past(HOUR, 24).help

    And got the response:

    Could not convert result "{minimum: 83.013917, minTime=1361337619432, maximum: 307.904591, maxTime=1361383219432, average: 161.63032972540182, sum: 93298.89984499985, count: 576, noData: false, realStart: 1361299318262, end: 1361385718262}" to Numeric

    So it looks like "minTime" and "maxTime" is the proper syntax (I tried this earlier, but I think I put "mintime" and "maxtime" which returns the same 0.0)

    Thanks for the help.

    Craig


  • Ah, ok. There are differences in the var names between M2M and MA, and also between MA 1.x and MA 2.x.