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

pointquery from a watchlist by watchlistname and do calculation


  • I would like to get the points in a watchlist and sum together in a dashboard rather than the defining hierarchy as the point cannot be present in more than one folder in the hierarchy. I can find <ma-watch-list-select> and <<ma-watch-list-chart>. May I know is there a way to get points from a watch-list in the dashboard without showing a dropdown?


  • Hi morris,

    You'll want to change the watch-list-xid but try this in your play area:

    <ma-watch-list-get watch-list-xid="WL_53fe36dd-0947-4b65-adc8-e19cbf9d7cdc" ng-model="getWatchlistPoints" on-points-change="points = $points"></ma-watch-list-get>
    
    {{points}}
    

  • @phildunlap said in pointquery from a watchlist by watchlistname and do calculation:

    <ma-watch-list-get watch-list-xid="WL_53fe36dd-0947-4b65-adc8-e19cbf9d7cdc" ng-model="getWatchlistPoints" on-points-change="points = $points"></ma-watch-list-get>

    {{points}}

    Hi phildunlap

    Thanks, it returns all the points in the watchlist. Is there a way to sum up their values? I was trying the following code without success.

    <ma-watch-list-get 
       watch-list-xid="WL_TotalPower" 
       ng-model="getWatchlistPoints" 
       on-points-change="points = $points">
    </ma-watch-list-get>
    <table>
     <tbody ng-init="total = 0">
      <tr ng-repeat="point in points">
        <td>{{point.deviceName }}</td>
        <td>{{point.xid}} </td>
        <td>{{point.name}}</td>
        <td><ma-get-point-value point="point"></ma-point-value></td>
        <td ng-init="$parent.total = $parent.total + point.value">
              {{point.value}}</td>
      </tr>
      <tr>
        <td>Total</td>
        <td></td>
        <td>{{ total }}</td>
      </tr>
    </tbody>
    </table>
    

  • @morris said in pointquery from a watchlist by watchlistname and do calculation:

    total = 0"

    When I change

    <td ng-init="$parent.total = $parent.total + point.value">
              {{point.value}}</td>
    

    to

    <td ng-init="$parent.total = $parent.total + 1">
              {{point.value}}</td> 
    

    I can get the points.length.


  • Jared showed me the right way to do this.

    <ma-watch-list-get watch-list-xid="WL_53fe36dd-0947-4b65-adc8-e19cbf9d7cdc" ng-model="getWatchlistPoints" on-points-change="points = $points"></ma-watch-list-get>
    
    <ma-get-point-value points="points"></ma-get-point-value>
    
    {{points | maSum:'value'}}
    

  • He made a great post a little while ago about how to include your own module definitions, if you find that you need to extend Mango in some way we haven't yet: https://forum.infiniteautomation.com/topic/2844/how-to-use-json-receiver-data-point/5


  • @phildunlap said in pointquery from a watchlist by watchlistname and do calculation:

    {{points | maSum:'value'}}

    Thanks phildunlap, that's very efficient in a few line.
    {{points | maSum:'value'}}
    helps. I will explore the link you provided as well. Thanks for your support.