Scripting Data Source
-
I have created a new script data source with a new point. I have the script scheduled to run every minute but can not get the point to update the value. I am new to this system and am just trying to figure out the capabilities at this time. I am monitoring my home with the system as a test site. I do not get any errors in the script module as there is only 1 line of code where I am incrementing the point value by adding 1 to it. When I view the point in the Watchers list, it never updates. I have set the point to an odd value from the watchers list but it doesn't change. Is there any documentation available that may help me?
-
Hi,
Can you post the script you are using so we can test. There is quite good documentation in the "?" pop up on the Scripting page but I'm guessing you have already found that.
Thanks,
Joel.
-
scriptVar = scriptVar + 1 ;
Joel,
Below is the export of the point.
{
"dataPoints":[
{
"loggingType":"ON_CHANGE",
"intervalLoggingPeriodType":"MINUTES",
"intervalLoggingType":"INSTANT",
"purgeType":"YEARS",
"pointLocator":{
"dataType":"NUMERIC",
"settable":true,
"varName":"scriptVar"
},
"eventDetectors":[
],
"engineeringUnits":"No units",
"plotType":"STEP",
"chartColour":null,
"chartRenderer":null,
"dataSourceXid":"DS_240092",
"defaultCacheSize":1,
"deviceName":"testScript",
"discardExtremeValues":false,
"discardHighLimit":1.7976931348623157E308,
"discardLowLimit":-1.7976931348623157E308,
"enabled":true,
"intervalLoggingPeriod":15,
"name":"scriptVar",
"purgeOverride":true,
"purgePeriod":1,
"textRenderer":{
"type":"PLAIN",
"suffix":""
},
"tolerance":0.0,
"xid":"DP_472381"
}
]
}Below is the export of the script data source.
{
"dataSources":[
{
"xid":"DS_240092",
"type":"SCRIPTING",
"alarmLevels":{
"SCRIPT_ERROR":"URGENT",
"DATA_TYPE_ERROR":"URGENT",
"LOG_ERROR":"URGENT"
},
"purgeType":"YEARS",
"context":[
{
"dataPointXid":"DP_320492",
"varName":"p7"
}
],
"logLevel":"DEBUG",
"cronPattern":"0 * * * * ?",
"executionDelaySeconds":0,
"script":"scriptVar = scriptVar + 1 ;",
"enabled":true,
"name":"testScript",
"purgeOverride":true,
"purgePeriod":1
}
]
} -
Thanks for the export of the point and data source.
You are not implementing your script correctly. Please refer to the documentation for examples.
For your scrip this will work: ```
scriptVar.set(scriptVar.value + 1 );Hope that helps, Joel.
-
Joel,
Thank You. That puts me on the right track.
Paul