Table of Contents

Checking for Good Quality incomingValue in a Script

Scripts on server Device tags will be triggered when the tag value changes in the server. The value of the incomingValue will not necessarily be good if this occurs during the initialization of the software. So sometimes its a good idea to check for the quality of the data before running the script.

Your script can start out with getting the quality of the incomingValue:

quality=incomingValue.getQuality();

“quality” will be a value from 0 up to 9999. See ValueObject Qualities for a list of possible quality values. Generally you will want to check for the quality set to “0”, Good Quality.

Use an “if” statement with the quality to determine whether to run the script or not.

if (quality==0) { //run the script
...
 (the script here)
...
 
}

See also:

Server Values vs incomingValue

TransSECS Devices - Scripting for PLC Servers

MIStudio Scripting, read more about ValueObject properties