Setting Several Data Points at once
-
Have multiple points and call set value on each one on the same button is how!
Here:
<ma-button ng-click="pt1.setValue(1);pt2.setValue(2);...." ></ma-button>
If its still clear as mud let me know!
Fox
-
Hi Matt,
Clearer, but still muddy :'D
Will you be so kind of elaborating a little further?
Thanks!
-
Matt,
Is it md-button or ma-button?
Best,
Rodrigo -
Both will work. Use an ma-point-query item or an ma-get-point-value to pull the point through by its xid then you can use the variable the point is assigned to and set its value.
Ill find some time to give you a better example...
Fox
-
@rodrigo said in Setting Several Data Points at once:
Hi Matt,
Clearer, but still muddy :'D
Will you be so kind of elaborating a little further?
Thanks!
Use ma-point-query to pull all of your wanted points through (Use the watchlist builder to help you generate your query).
You can use a watchlist to put all the points you want in one place also then use that to pull all the points through in that watchlist
(refer to <ma-watch-list-get>),Alternatively if you know what points you want, use their xids and use ma-get-point-value to pull the data point information through.
<ma-get-point-value point-xid="XID_OF_YOUR_PT" point="pointName_no_spaces"/>
Then when you click on your button:<md-button ng-click="pointName_no_spaces.setValue(newValue);nextPt.setValue(0);"></md-button>
Hope this expands a bit more on what to do.
Fox
-
Thanks Matt!
Will give it a try!
Best,
Rodrigo -
Hi Matt,
I gave this a try by writting the following
<ma-get-point-value point-xid="DP03_CS01_UMABAS003" point="myPoint"></ma-get-point-value> <ma-button ng-click="myPoint.setValue(0)" raised="true" palette="primary" label="ON" tooltip="Encender" icon="power_settings_new" hue="hue-2"></ma-button> <br> <md-button ng-click="myPoint.setValue(0)" class="md-primary md-raised md-hue-2" icon="power_settings_new">ON</md-button>
In both cases, with the ma-button or md-button, nothing happens when clicked. I am trying to turn on the equipment with xid = DP03_CS01_UMABAS003 (it is a modbus coil status register, when set to zero it's turned on, when set to 1 is turned off).
What am I missing?I am learning Angular as you can see, I have tried AngularJS and Angular.io, Can both be used in Mango?
Best,
Rodrigo -
AngularjS only.
Also, ensure you have set permissions for those points if you are logged in as someone other than admin.
Also if it's a binary point you may need to send a true/false instead.That's a guess from the issues you are having
Fox
-
Thanks for the immediate response!
I tried everything "One", "1", "ON" (this is the way the text is rendered), without success.
It was the true/false, as you stated!Thanks Matt!
Best,
Rodrigo -
Anytime :)
-
Hi,
I have managed to set a couple of binary data points by using <ma-get-point-value>, as follows:
<div> <ma-get-point-value point-xid="DP03_CS01_UMABAS013" point="myPoint1"></ma-get-point-value> <ma-get-point-value point-xid="DP03_CS01_UMABAS012" point="myPoint2"></ma-get-point-value> <ma-get-point-value point-xid="DP03_CS01_UMABAS011" point="myPoint3"></ma-get-point-value> <ma-get-point-value point-xid="DP03_CS01_FCBAS009" point="myPoint4"></ma-get-point-value> <ma-button ng-click="myPoint1.setValue(false);myPoint2.setValue(false);myPoint3.setValue(false);myPoint4.setValue(false)" raised="true" palette="primary" label="ON" icon="power_settings_new" hue="hue-1"></ma-button> <ma-button ng-click="myPoint1.setValue(true);myPoint2.setValue(true);myPoint3.setValue(true);myPoint4.setValue(true)" raised="true" palette="warn" label="OFF" icon="power_settings_new" hue="hue-3"></ma-button>
Now, how to do the same with 100 points?
Based on what @Matt said, I understand I should create a watch list with this points and then use ma-watch-list-get, instead of 100 lines of ma-get-point-value.
The problem, How should the watch list be created? there are several options for this (can it be a static watch list?), Also, how to use ma-watch-list-get? I have tried everything that came to my mind (which is not a lot), without success.Thanks!
Best,
Rodrigo -
If you need to do that many, use an RQL query to pull all of the points and set them in a scripted datasource in a loop
OR
Write an angularJS Controller and use the mango api to set them all in one go
Fox
-
If you are going to need to be setting 100 data points I would consider using a scripting data source. Create a single Binary point in the scripting data source and add the 100 data points to the CONTEXT. Then write a loop in the script that sets all the context points to the value of the Binary points. On your dashboard, you then just set the scripting data source binary point.
-
Thanks Craig
-
Thanks guys!
Will give this a try and let you know how it goes.
Best,
Rodrigo -
Hi guys,
A question regarding the method @CraigWeb described, will this also work for the Advanced Scheduler?
Or should I enter all those points separately in the scheduler?Best,
Rodrigo -
Yes it will work since the advanced scheduler can be used to run a script on fire.
Fox
-
Thanks Mr. Fox!
Rodrigo
-
@craigweb
Hello guys, would you be able to provide some more help on how to write this loop?Thanks,
Rodrigo -
for (var pnt in CONTEXT_POINTS) { this[pnt].set(1); }
Fox