Filter for point values?
-
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?
-
sorry for stupid question. Answer:
<div>Number: {{array|filter:"1"}}</div>
-
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.
-
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
-
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?
-
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?
-
Thanks it works fine! I use auto-update so I need live data. Just add "array.slice(1,-1) and remove virtual data.