• 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

    Get(true).proportion returns NaN

    User help
    2
    6
    2.8k
    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.
    • P
      PCM
      last edited by

      The metadata script:

      return WTenabled.past(HOUR, 1).get(true).proportion * 100; // % on last hour
      

      works in Mango 1.12.3, returning values between 0 and 100 inclusive depending on the past hour.

      However, it no longer works in MA 2.0: it returns: "Success. result=NaN"
      If I change get(true) to get(false):

      return WTenabled.past(HOUR, 1).get(false).proportion * 100; // % on last hour
      

      it returns: "Success. result=0.0"
      I wonder if the proportion code is missing a check for 0/0?

      1 Reply Last reply Reply Quote 0
      • M
        mlohbihler
        last edited by

        Are there actually any values over the past hour? You may need to add a check for "count > 0". (Not the actual code required, just saying...)

        Best regards,
        Matthew

        1 Reply Last reply Reply Quote 0
        • P
          PCM
          last edited by

          There are no transitions during the past hour, but it did have a value that should have returned either 0% or 100%. as it did under M2M 1.12.3 even when there were no changes in the last hour. Also, get(false).proportion returns 0.0 but get(true).proportion returns NaN. If false returns 0.0, shouldn't true return 1.0?

          I see that now there is a .percentage function that can be used insead of .proportion * 100%. I tried it with the same result.

          Thank you for helping.

          1 Reply Last reply Reply Quote 0
          • M
            mlohbihler
            last edited by

            I found the problem. There will be a fix for this in the next release.

            Best regards,
            Matthew

            1 Reply Last reply Reply Quote 0
            • P
              PCM
              last edited by

              Great, thanks! Would that be 2.0.4? Where can I find the release notes or planned release date?

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