maWatchListGet not returning .value
-
This is no doubt explained somewhere, but I've been unable to find the answer. I'm attempting to pass a watchlist array via scope to a directive by an <ma-watch-list-get> request. The problem is that the {{points}} array therefrom doesn't contain the point's value (which is contained in the lastPayload object).
If I request values via <ma-get-point-value>, the values angumagically appear in the returned {{points}} array, retrievable either through the newly included last payload object or, simply, through point.value.
When I attempt to access the points array passed into a directive, however, I am unable to retrieve the point value. Any help would be appreciated.
<ma-watch-list-get ng-model="designer.watchList" parameters="designer.parameters" on-points-change="designer.points = $points" id="53368ae5-7ad5-40f7-b3e8-96dd61236a48" watch-list-xid="WL_test"></ma-watch-list-get> <div>{{designer.points}}</div> <!--I'll save you the lengthy array here--> <table> <tbody> <tr ng-repeat="point in designer.points"> <td><ma-get-point-value point="point"></ma-get-point-value></td> <td>{{point.name}}</td> <td>{{point.lastPayload.value.value}} </td> </tr> </tbody> </table>
-
Hi @bullitbd
What is displayed on your dashboard. I copied your code and changed the watchlist xid and it worked for me.
Does your watchlist have parameters that need to be set?
I don't think it is advisable to put the<ma-get-point-value>
in a<td>
Also, if you want to format the JSON use<pre ng-bind="designer. points | json"></pre>
edit. Jared: There is no reason you cannot put the <ma-get-point-value> in a td.
-
@bullitbd Your observations are 100% in the with the design of the components. Fetching data points will not automatically get their point values. That is what the
<ma-get-point-value>
component is there for.I would suggest just sticking a
<ma-get-point-value points="designer.points">
on your page somewhere. -
Thanks @Jared-Wiltshire. Just to be clear, by design the get-point-value then modifies the designer.points object on which it is called... so that, when passed via scope, designer.points includes the lastPayload object...
Cool. Curious why values are not included in the designer.points object in the first place?
Also, I'm a bit confused - in:
<ma-watch-list-get ng-model="designer.watchList" parameters="designer.parameters" on-points-change="designer.points = $points" id="53368ae5-7ad5-40f7-b3e8-96dd61236a48" watch-list-xid="WL_test"></ma-watch-list-get>
does on-points-change essentially update the model? perhaps the directive code would help my curiosity.
Thanks for your patience and clear responses.
-
Thanks, @CraigWeb. Appreciate the quick response. Pilot error there. But could you enlighten me on what parameters one might set on a watchlist?
-
@bullitbd All the code is opened sourced @ https://github.com/infiniteautomation/ma-dashboards/tree/main/UI/web-src/ngMango
Parameters can be added to watchlists to filter the data points, if the watchlist is not a static watchlist. ie: filter by data source or tags.
-
Thanks - super.
-
@bullitbd said in maWatchListGet not returning .value:
Thanks @Jared-Wiltshire. Just to be clear, by design the get-point-value then modifies the designer.points object on which it is called... so that, when passed via scope, designer.points includes the lastPayload object...
Correct, and crucially the
value
property.@bullitbd said in maWatchListGet not returning .value:
Cool. Curious why values are not included in the designer.points object in the first place?
Because it incurs additional overhead and is not always required.
@bullitbd said in maWatchListGet not returning .value:
does on-points-change essentially update the model?
It does indeed.
@bullitbd said in maWatchListGet not returning .value:
perhaps the directive code would help my curiosity.
Specific link - https://github.com/infiniteautomation/ma-dashboards/blob/main/UI/web-src/ngMango/directives/watchListGet.js
-
Thank you. The work you've done there is nothing short of amazing.
-
This post is deleted! -
This post is deleted!