make set point stick in script
-
I am attempting to set a metapoint value in script at the end of a loop. the result acknowledges the setpoint however the point value does not log and I am logging all data for that point? Shouldn't this be sticking?
dataPoints[0].runtime.set(value,timestamp);
Setting point Last_Unit_Processed to Velo-201 @12/09/2018 17:03:50When I look at this point it has no value logged.
-
I find that also, I somehow get the feeling the set value is only allowed for user input....
One thing to note is if you're running the script using the green tick it won't physically set the values, only show you the outcomes of said script.
If this is the script in the actual metapoint itself, use return with the value. Alternatvely, just for my curiosity and interest... can you try running the same script and using that to set a virtual datapoint instead? Just that from looking at what you've provided I have a feeling that you want to set a value at a given time...Fox
-
Calling the set function from a meta point is the same as a user entering and setting that value to a point (during meta point runtime, history generation was recently changed to behave like a scripting data source that saves historical). That means it has a complicated relationship with logging type.
But, you said it's on all data, so it should have saved it if the script tried to set a value while it was enabled. Note also that the target point will need to be enabled for the meta point to execute. Have you checked if there are events for the meta point? Does your meta point have sufficient set data point permissions?
-
@phildunlap said in make set point stick in script:
Does your meta point have sufficient set data point permissions?
You mean even a script needs to have set permissions??
-
Without getting too into it or the outstanding issues surrounding it, yes,
-
So I triggered it with a minute update event and YES it does log now. Wow thanks guys it is working this way. You are correct about the green check not really setting the value and something tells me I knew this last year.
-
The checkmark is intended to validate that the script is working as intended. It would strike me as rather unfortunate if mistakes during development made it to devices.
You can also trigger a meta point to execute using the "Force read (if supported)" circular arrow icon on the data point details page (formerly "Refresh" in the old pages), or from a running script body (not a validate) using
RuntimeManager.refreshDataPoint( dataPointXid );
if the script has permissions to the points' data source.