• 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

    Filter for point values?

    How-To
    3
    7
    2.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.
    • R
      Robertas Kaunas
      last edited by

      Hello, is in MA any function for filtering values of point. For example I have point with 1,2,3,4,5,1,,2,3,5,2,1,3,5,1,2 values and I need get only '1'. Should i write my own module?

      1 Reply Last reply Reply Quote 0
      • R
        Robertas Kaunas
        last edited by phildunlap

        sorry for stupid question. Answer:

        <div>Number: {{array|filter:"1"}}</div>
        
        1 Reply Last reply Reply Quote 0
        • phildunlapP
          phildunlap
          last edited by

          Hi Robertas Kaunas, welcome to the forum!

          Thanks for sharing the solution you found!

          I went ahead and edited some markup into your last post. Using three ``` marks above and below code will change the formatting / coloring on our forum.

          1 Reply Last reply Reply Quote 0
          • Jared WiltshireJ
            Jared Wiltshire
            last edited by

            If you are filtering an array of point values then I suspect you actually want
            {{ array | filter:{value: 1} }}

            This will only filter on the point value, rather than all fields in the array objects. See https://docs.angularjs.org/api/ng/filter/filter

            Developer at Radix IoT

            1 Reply Last reply Reply Quote 0
            • R
              Robertas Kaunas
              last edited by Robertas Kaunas

              One more obstacle. Then I try get real values with <ma-get-values> I always got one more last value with changed timestamp,

              How can I get real values as in my database?
              0_1548338803080_13be7037-ef81-4798-aef5-5642222cdd5f-image.png

              1 Reply Last reply Reply Quote 0
              • phildunlapP
                phildunlap
                last edited by phildunlap

                This thread likely contains an explanation and solution: https://forum.infiniteautomation.com/topic/3936/retrieving-historical-values/4

                TLDR Bookend values are added for charting purposes, where a value will appear at the interval start time that is either a recorded sample exactly at that millisecond or the value prior to the period, and a value is presented at the end of the period that is the same as the last value in the period (or the value before the period, if none in the period). While a bookend="false" parameter was added to the directive, I do not believe that has been released yet, so you'll have to do the solution in the thread for now,

                [0, 1, 2].slice(1, -1); // [1]
                

                But without having the markup I'm not certain that applies to you. You're querying a time range, not for the latest X values (doesn't use bookending), yes?

                1 Reply Last reply Reply Quote 0
                • R
                  Robertas Kaunas
                  last edited by Robertas Kaunas

                  Thanks it works fine! I use auto-update so I need live data. Just add "array.slice(1,-1) and remove virtual data.

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