What are the options for evaluating the quality code returned from system.tag.writeBlocking? I would rather have a comparison to a meaningful value like “Good” than a number like 192. Do we have access to built-in constants, or would I need to write my own?
Also, I see that in the expression language, there’s an isGood() function which returns True for any of the good tag quality values. Is there an equivalent available in scripting?
Hi, apologies if I'm resurecting a dead topic, out of curiousity I tried your method
from com.inductiveautomation.ignition.common.sqltags.model.types import DataQuality
res = system.tag.readBlocking(["[default]Testing/test_events/Ref_to_Trigger"])
print(res[0].quality)
print(DataQuality.GOOD_DATA)
if res[0].quality == DataQuality.GOOD_DATA:
print("I confirm that the quality is good")
Somehow, the IF statement is never true, although the 2 prints shows the exact same "Good" string.
I obviously opted for the isGood() method and it works, but I'm just curious why the the statement is false
im pretty sure the sqltags library is an outdated, so the enum probably is no good anymore or moved to a different location,
what version are you running?
Edit:
yup seems this should work instead now on newer version:
from com.inductiveautomation.ignition.common.model.values import QualityCode
res = system.tag.readBlocking(["[default]Components/oneShot"])
return QualityCode.Good == res[0].quality