Setting Several Data Points at once
-
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
-
Hi Matt,
You are alway ready to help! Thanks for that.
I am not bening able to understand how to do this, I have created the Scripting Data Source and added to it, External Context Points (from other Data Sources), this points are the ones that turn devices ON or OFF. Like this
Then, I created the Binary data point with this properties
Would you be so kind of expanding your previous reply a little more with this data?
Thanks in advance.
Best,
Rodrigo -
Add all your modbus context points, PLUS one virtual datapoint that is settable. Make the virtual point the context point for firing. All other context points must not be ticked for firing the script.
Put inside the for loop:
if(this[pnt].xid==virtualpointxid){continue;} this[pnt].set..
Dont want the script point to set the virtual point and make it fire itself again.
Thus when the virtual point in the context is set, the script will run.
If using an advanced scheduler, make it set that virtual point when it shifts from low to high.Hope that enlightens you
Fox
-
thanks Matt, but I am not able to understand how to make it work :(
-
ok I shall write a complete solution for you tonight. Dont know what time it is where you are but I shall assemble it all for you later today.
Fox
-
@mattfox
Really! Awesome, do not worry about the time, here is 19:21 (March 5) now.
Paraguayan time.
I could read it later tonight or even tomorrow and try to apply it.Thanks a lot!