Value Change Script tag quality check

For value change script how do you run a statement only when quality good.

tried If currentValue.quality == Good:

but that doesn't work.

NM... found it .... just need to do
if currentValue.quality.good

1 Like

Correct. Good isn't a Python constant!

good catch... I didn't copy/paste. I was actually trying "good" or the number codes for quality..

QualityCode objects have a boolean isGood() member function. Jython automatically turns this into a 'virtual' good property. Either works. There's also isBad(), isError(), isBadOrError(), and a handful of others:
https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.27/com/inductiveautomation/ignition/common/model/values/QualityCode.html#isGood()

I would definitely recommend sticking to these boolean checks and avoiding strict comparisons to particular quality codes as much as possible.

2 Likes