Test for attribute quality
- Last UpdatedFeb 12, 2026
- 1 minute read
When you use Attribute Data Quality for diagnostic purposes, we recommend that you use the best practice shown below, rather that using the following method:
The actual value of a Bad and Good quality is 0 and 192, respectively. Past methods for testing the Quality value have resulted in code such as:
If MyObject.PV.Quality == 192 then
Best practice
A more appropriate way to code such tests is to call one of the quality test functions available within the QuickScript language. The previous example for testing for a GOOD quality condition would be coded as:
If IsGood(MyObject.PV.Quality) then
The available functions for testing the Quality value of an attribute are as follows. The functions return a Boolean (True) value for success and a Boolean (False) for failure of the test.
Test Condition:
-
IsBad
-
IsGood
-
IsInitializing
-
IsUncertain
-
IsUsable
As in the above example, the coding syntax requires the desired function (the specific attribute to test). Note that the parenthesis around the quality is required.
Set Condition Function
The available functions for setting the Quality value of an attribute are as follows. The functions return a Boolean (True) value for success and a Boolean (False) for failure of the test.
Set Condition:
-
SetBad
-
SetGood
-
SetInitializing
-
SetUncertain
The syntax for the Set Condition functions is the same as the Test Condition functions except that the attribute to be SET must be an attribute within the object that the script is attached to.
Example:
SetInitializing(me.PV)
For more information on Attribute Data Quality, see Templates.