Scripting data source points don't get a value
-
Hi All,
I am pretty sure this is newbie stuff, but I have set up a scripting datasource, added some external points, can make caculations on my points and when i validate the script, I canlog.info
values that seem to make sense. The problem is that none of my datapoints in my datasource receive values. I am thinking there is something simple I am missing, but can't figure it out.
I set a CRON pattern for every 30 seconds, saved the script, enabled it, but can't think of what I am missing.
When I look at the data points window, all the values show either a diamond with a question mark in them or No value.I have created my script which has 30 ish external points that I use to calculate a total energy, CO2 etc for an energy dashboard, and my datapoints I am hoping to track the individual calculated values for energy etc on each piece of equipment. Any thoughts?
This is on 3.6
I am certain it is just something I have either not set or shouldn't have set.Jim
-
Afternoon @realmooseman, if I can be of any assistance, are you able to share your script between some code tags?
A screenshot would be handy too.My first thoughts are, do each of the scripted datasource points have their own unique variable name?
I would have thought you can set values withmyScriptedPt = cO2Calc();
Alternatively, see if they are 'settable', you can then try with
myScriptedPt.set( co2Cal() );
Finally, are your modules up to date? I know there have been a fair number of fixes and tweaks released.
That's all I can think of seeing how I'm still using 3.5.6
Phil or Jared will likely be better able to assist with this conundrum of yours than I. -
Here is a simple snap shot of what I have done.
testvar and var_oat are my data points in the scripting data source.So
LOG.info
will print the correct values when i run validate. I am aware of having to save -
Hi realmoose,
I would encourage you to read the help for the scripting data source via the blue question mark next to "Scripting data source properties" and the help page about Mango JavaScript.
I would have thought you can set values with
myScriptedPt = cO2Calc();
Alternatively, see if they are 'settable', you can then try with
myScriptedPt.set( co2Cal() );
Fox's suggestion of using the set function is probably the right one. Though you cannot set values with assignment to the variable name, That will just assign the value to the variable name in the JavaScript engine and shadow the variable name, making it inaccessible to set to.
https://help.infiniteautomation.com/about-mango-java-script
https://help.infiniteautomation.com/scripting-data-source -
Hey Folks,
Thank you so much! It was indeed a newbie thing as suggested by Phil and Fox.
Really appreciate your help.
Jim.