-
sean
@mattfox I just want save object in value or value can't be object?
Code is this<div ng-init="rackList = [ {'Name': 'CardName_A01', 'Rack': 'CardNo_A01', 'Label': 'A', 'idx': 1}, {'Name': 'CardName_A02', 'Rack': 'CardNo_A02', 'Label': 'A', 'idx': 2}, {'Name': 'CardName_A03', 'Rack':'CardNo_A03', 'Label': 'A', 'idx': 3}, {'Name': 'CardName_A04', 'Rack': 'CardNo_A04', 'Label': 'A', 'idx': 4}, {'Name': 'CardName_A05', 'Rack': 'CardNo_A05', 'Label': 'A', 'idx': 5}, {'Name': 'CardName_A06', 'Rack': 'CardNo_A06', 'Label': 'A', 'idx': 6}, {'Name': 'CardName_A07', 'Rack': 'CardNo_A07', 'Label': 'A', 'idx': 7}, {'Name': 'CardName_A08', 'Rack':'CardNo_A08', 'Label': 'A', 'idx': 8}, {'Name': 'CardName_A09', 'Rack': 'CardNo_A09', 'Label': 'A', 'idx': 9}, {'Name': 'CardName_A10', 'Rack': 'CardNo_A10', 'Label': 'A', 'idx': 10}, {'Name': 'CardName_B01', 'Rack': 'CardNo_B01', 'Label': 'B', 'idx': 1}, {'Name': 'CardName_B02', 'Rack': 'CardNo_B02', 'Label': 'B', 'idx': 2}, {'Name': 'CardName_B03', 'Rack':'CardNo_B03', 'Label': 'B', 'idx': 3}, {'Name': 'CardName_B04', 'Rack': 'CardNo_B04', 'Label': 'B', 'idx': 4}, {'Name': 'CardName_B05', 'Rack': 'CardNo_B05', 'Label': 'B', 'idx': 5}, {'Name': 'CardName_B06', 'Rack': 'CardNo_B06', 'Label': 'B', 'idx': 6}, {'Name': 'CardName_B07', 'Rack': 'CardNo_B07', 'Label': 'B', 'idx': 7}, {'Name': 'CardName_B08', 'Rack':'CardNo_B08', 'Label': 'B', 'idx': 8}, {'Name': 'CardName_B09', 'Rack': 'CardNo_B09', 'Label': 'B', 'idx': 9}, {'Name': 'CardName_B10', 'Rack': 'CardNo_B10', 'Label': 'B', 'idx': 10}, {'Name': 'CardName_C01', 'Rack': 'CardNo_C01', 'Label': 'C', 'idx': 1}, {'Name': 'CardName_C02', 'Rack': 'CardNo_C02', 'Label': 'C', 'idx': 2}, {'Name': 'CardName_C03', 'Rack':'CardNo_C03', 'Label': 'C', 'idx': 3}, {'Name': 'CardName_C04', 'Rack': 'CardNo_C04', 'Label': 'C', 'idx': 4}, {'Name': 'CardName_C05', 'Rack': 'CardNo_C05', 'Label': 'C', 'idx': 5}, {'Name': 'CardName_C06', 'Rack': 'CardNo_C06', 'Label': 'C', 'idx': 6}, {'Name': 'CardName_C07', 'Rack': 'CardNo_C07', 'Label': 'C', 'idx': 7}, {'Name': 'CardName_C08', 'Rack':'CardNo_C08', 'Label': 'C', 'idx': 8}, {'Name': 'CardName_C09', 'Rack': 'CardNo_C09', 'Label': 'C', 'idx': 9}, {'Name': 'CardName_C10', 'Rack': 'CardNo_C10', 'Label': 'C', 'idx': 10}, {'Name': 'CardName_D01', 'Rack': 'CardNo_D01', 'Label': 'D', 'idx': 1}, {'Name': 'CardName_D02', 'Rack': 'CardNo_D02', 'Label': 'D', 'idx': 2}, {'Name': 'CardName_D03', 'Rack':'CardNo_D03', 'Label': 'D', 'idx': 3}, {'Name': 'CardName_D04', 'Rack': 'CardNo_D04', 'Label': 'D', 'idx': 4}, {'Name': 'CardName_D05', 'Rack': 'CardNo_D05', 'Label': 'D', 'idx': 5}, {'Name': 'CardName_D06', 'Rack': 'CardNo_D06', 'Label': 'D', 'idx': 6}, {'Name': 'CardName_D07', 'Rack': 'CardNo_D07', 'Label': 'D', 'idx': 7}, {'Name': 'CardName_D08', 'Rack':'CardNo_D08', 'Label': 'D', 'idx': 8}, {'Name': 'CardName_D09', 'Rack': 'CardNo_D09', 'Label': 'D', 'idx': 9}, {'Name': 'CardName_D10', 'Rack': 'CardNo_D10', 'Label': 'D', 'idx': 10}, {'Name': 'CardName_E01', 'Rack': 'CardNo_E01', 'Label': 'E', 'idx': 1}, {'Name': 'CardName_E02', 'Rack': 'CardNo_E02', 'Label': 'E', 'idx': 2}, {'Name': 'CardName_E03', 'Rack':'CardNo_E03', 'Label': 'E', 'idx': 3}, {'Name': 'CardName_E04', 'Rack': 'CardNo_E04', 'Label': 'E', 'idx': 4} ]"></div> <ma-get-point-value point-xid="XID_cardControllerLastRack" point="LastRackSelect"></ma-get-point-value> <div ng-init="pointName.Rack = LastRackSelect.value"></div> <ma-point-query query="{$and: true,name:pointName.Rack,deviceName: 'RackAccessSystem'}" sort="'name'" points="points"></ma-point-query> <ma-point-query query="{$and: true,name:pointName.Name,deviceName: 'RackAccessSystem'}" sort="'name'" points="names"></ma-point-query> <ma-get-point-value points="points"></ma-get-point-value> <ma-get-point-value points="names"></ma-get-point-value> <form layout-gt-sm="row" name="Form"> <md-input-container flex="" id="cardedit"> <label>select Item</label> <md-select class="select-block" ng-model="pointName" ng-change="LastRackSelect.setValue(pointName)" ng-model-options="{getterSetter:true}"> <md-option ng-repeat="Rack in rackList" ng-value="Rack">{{Rack.Name | limitTo:3:9}}</md-option> </md-select> </md-input-container> </form>
I want to save select
pointName
object to save in datapointXID_cardControllerLastRack
when nexttime into this page can loadXID_cardControllerLastRack
value to use default select ng-model -
sean
A question about Point Value type,
How to save object type likenewValue = {"Name":"CardName_A02","Rack":"CardNo_A02","Label":"A","idx":2}
into datapoint ?
I use
Point.setValue(newValue)
but in Point's value is null
How do I do to save object type value in datapoint? -
sean
thank you
use $sce can show inside component<ma-get-point-value point-xid="DP_001_Meter_kWh" point="c001_Meter_kWh"></ma-get-point-value>
but can't use bind
{{c001_Meter_kWh.value}}
in other side to see value
how to fix it? -
sean
I got new idea
use component
app.component("pointCom", { bindings: { point: "<", qty: "@", min: "@", max: "@" }, controller: dataController, controllerAs: "dc", template:` <span>Render</span> <div ng-bind-html="dc.sour"> </div> ` }); dataController.$inject = ["$scope"] function dataController($scope){ let dc = this let P = dc.point let Q = dc.qty let min = dc.min let max = dc.max let num = 0 this.$onChanges = function() { let p = dc.point dc.sour = '' max = dc.max num = dc.min console.log(school) if (max !== undefined){ Q = max } else { Q = dc.qty } if (p !== undefined){ for (let i=0; i < Q; i++){ num = Number(num) num = num.pad(3) dc.sour += ` <ma-get-point-value point-xid="DP_${num}_Meter_kWh" point="c${num}_Meter_kWh"></ma-get-point-value> <ma-get-point-value point-xid="DP_${num}_Meter_V" point="c${num}_Meter_V"></ma-get-point-value> <ma-get-point-value point-xid="DP_${num}_Meter_A" point="c${num}_Meter_A"></ma-get-point-value> ` num++ } console.log(dc.sour) angular.element(dc.sour) } } Number.prototype.pad = function(size) { let s = String(this) while (s.length < (size || 2)) {s = "0" + s;} return s } }
but in the html dom
<ma-get-point-value>
just dispear like this pic
how do I fix it?in console.log can see dc.sour
<ma-get-point-value point-xid="DP_001_Meter_kWh" point="c001_Meter_kWh"></ma-get-point-value> <ma-get-point-value point-xid="DP_001_Meter_V" point="c001_Meter_V"></ma-get-point-value> <ma-get-point-value point-xid="DP_001_Meter_A" point="c001_Meter_A"></ma-get-point-value>
-
-
sean
when I have maybe 10 datapoint's xid like "DP_c01_temperature" "DP_c02_temperature" ... "DP_c10_temperature"
I want use ng-repeat to get 1 to 10 index code like this
<div ng-repeat="x in [].constructor(10) track by index"> <ma-get-point-value point-xid="DP_c{{index}}_temperature" point="c{{index}}_temperature"></ma-get-point-value> <div class="value">C{{index}} Temperature: <span ng-bind="c{{index}}_temperature.value"></span></div> </div>
but point in console Error: [$parse:syntax] Syntax Error: Token '{' is an unexpected token at column 4 of the expression [c{{index}}_temperature] starting at [{{index}}_temperature].
How can I fix it ?
-
sean
About like script in the previous version this script can be work . but in 3.7.7 have this error,
How can I fixTypeError: com.serotonin.m2m2.db.dao.MailingListDao.instance.getMailingList is not a function at line: 216 function sendEmail(contents,recipients){ var zHead = g_customerName + "-[zDCIM System Report]"; var dsvo = com.serotonin.m2m2.db.dao.MailingListDao.instance.getMailingList("XID_zlabsMailList"); var zlabsMailingList = String(dsvo).slice(13, -2); //print(typeof(dsvo)); //print(dsvo); //print(zlabsMailingList); var dsvo1 = com.serotonin.m2m2.db.dao.MailingListDao.instance.getMailingList("XID_customerMailList"); // print(dsvo1); var userMailingList = String(dsvo1).slice(13, -2); //print(userMailingList); var defaultMailList = ""; if (zlabsMailingList.length > 0){defaultMailList = zlabsMailingList;} if (userMailingList.length > 0) {defaultMailList = defaultMailList + "," + userMailingList ; } var the_recipientMail = (typeof recipients !== 'undefined') ? recipients : defaultMailList; //print(the_recipientMail); var theRecipientArray = the_recipientMail.split(','); //print(theRecipientArray); if (the_recipientMail.length > 0){ var emailContent = new com.serotonin.web.mail.EmailContent(null, contents, com.serotonin.m2m2.Common.UTF8); //print(emailContent); com.serotonin.m2m2.rt.maint.work.EmailWorkItem.queueEmail(theRecipientArray, zHead, emailContent, null); } }
-
sean
I have a metal datapoint script like this
var triggerSMSAction = false; var thisText = ""; var NL = "\r\n"; var S = my.value; print('my.value= '+my.value); //print(my); var resendMsgTimeDelay = 300; var Ptr = -1; var txt = ""; var theSecondsDelyforSignalVerification = 30; //--mango timestamp value in milliseconds since the epoch var now = new Date().getTime(); //print("now=",now); var o1lastValue,o1_isLeak,o1; o1 = getDataPointByXID("XID_MainDC_Leak_A"); // print(o1); o1lastValue = o1.lastValue(); print ("o1lastValue =",o1lastValue); o1_isLeak = o1lastValue.value; print("o1_isLeak =",o1_isLeak); if (o1_isLeak === true) { print ("now =",now); print ("o1LastValueTime =",o1lastValue.time); timeDiff = (now - o1lastValue.time)/1000; print("timeDiff =",timeDiff); if (timeDiff <= theSecondsDelyforSignalVerification) {o1_isLeak=false;} } //====================================================================== Ptr = Ptr + 1; if (o1_isLeak === true){ print("o1_isLeak=",o1_isLeak); print ("Debug it !!"); if (!(S & Mask[Ptr])) { // 0101 & 0100 => 0100 => true // do stuff txt = 'Delay-Alarm'; LOG.info(txt); S = S | Mask[Ptr] ; triggerSMSAction = true; thisText = thisText + txt + NL; } }else{ if (S & Mask[Ptr]) { // 0101 & 0100 => 0100 => true // from true to false txt = 'Delay-reCover'; LOG.info(txt); S = S ^ Mask[Ptr] ; triggerSMSAction = true; thisText = thisText + txt + NL; } } function getDataPointByXID(xid) { var dataPoints = DataPointQuery.query("eq(xid,"+xid+")"); if( dataPoints.length !== 1 ) throw LOG.info("Data point with xid '" + xid + "' not found."); return dataPoints[0].runtime; }
I turn the datapoint "XID_MainDC_Leak_A" value to true but in the if (o1_isLeak === true) script will not work?
How do I do fix it? -
sean
@phildunlap Phildunlap
In therecipients = ["you@doman.extension"];
how to use mailling list like XID_ourGroupMailList this mail group in here? -
sean
How can change datapoint value from user module Angularjs. code like is
app.directive("alertEvent", function(){ return { restrict: "E", scope: { point: "=", check: "=" }, link: function(scope, elemnt, attrs){ var audio = new Audio('/rest/v2/file-stores/public/AlarmSound.mp3'); audio.muted = false; scope.$watch("point.value", function(newValue, oldValue){ var P = newValue; var Ch = scope.check; if (P == true){ if (Ch == true) { for (let n =0; n<10; n++){ setTimeout(function(){ audio.play(); },6000*n)} scope.point.value = false; } else { audio.pause(); } } else { audio.pause(); } }) } } });
want to when audio.play() finished change scope.point this datapoint value to false,How to I do?