# Value Changed Tag Event Data Quality

**URL:** <https://forum.inductiveautomation.com/t/value-changed-tag-event-data-quality/29922>\
**Category:** General Discussion\
**Created:** [November 13, 2019, 7:49pm UTC](https://forum.inductiveautomation.com/t/value-changed-tag-event-data-quality/29922 "2019-11-13T19:49:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![BryanB](https://avatars.discourse-cdn.com/v4/letter/b/57b2e6/32.png) [@BryanB](https://forum.inductiveautomation.com/u/BryanB)\
**Post date:** [November 13, 2019, 7:49pm UTC](https://forum.inductiveautomation.com/t/value-changed-tag-event-data-quality/29922/1 "2019-11-13T19:49:37Z")

</div>

I’ve been chasing this one for a while and haven’t been able to get it figured out. I’m looking to condition a value changed script on a tag event with the value, initial change, and quality and can’t figure out the proper syntax.

Here’s what I have right now:

```auto
if currentValue.value == 1 and initialChange == 0:
   # do stuff

```

What do I need to do to also condition based on data quality? I haven’t been able to successfully use

```auto
currentValue.quality == "Good"

```

or

```auto
currentValue.quality == 192

```

What’s the proper syntax?

Also, is there a good place to look up the members of a data type (for example, the “dataQuality” data type)?

Thanks!

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [November 13, 2019, 7:54pm UTC](https://forum.inductiveautomation.com/t/value-changed-tag-event-data-quality/29922/2 "2019-11-13T19:54:43Z")

</div>

```auto
if currentValue.quality.isGood():
    *code here*

```

---

<div class="post-metadata">

**Author:** ![BryanB](https://avatars.discourse-cdn.com/v4/letter/b/57b2e6/32.png) [@BryanB](https://forum.inductiveautomation.com/u/BryanB)\
**Post date:** [November 13, 2019, 8:18pm UTC](https://forum.inductiveautomation.com/t/value-changed-tag-event-data-quality/29922/3 "2019-11-13T20:18:10Z")

</div>

I forgot to mention that I’m using 7.9.9. My understanding is the “isGood()” function was introduced in 7.9.11.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 13, 2019, 9:03pm UTC](https://forum.inductiveautomation.com/t/value-changed-tag-event-data-quality/29922/4 "2019-11-13T21:03:59Z")

</div>

The `isGood()` _expression_ function was added in 7.9.11, but the actual quality object returned by `QualifiedValue.getQuality()` has had an `isGood()` method for a lot longer. You can also simplify @Duffanator’s a little bit more; `if currentValue.quality.good:` will do the same thing.

---

<div class="post-metadata">

**Author:** ![BryanB](https://avatars.discourse-cdn.com/v4/letter/b/57b2e6/32.png) [@BryanB](https://forum.inductiveautomation.com/u/BryanB)\
**Post date:** [November 13, 2019, 9:19pm UTC](https://forum.inductiveautomation.com/t/value-changed-tag-event-data-quality/29922/5 "2019-11-13T21:19:52Z")

</div>

That worked, thank you. What I ended up with is:

```auto
if currentValue.value == 1 and currentValue.quality.good and initialChange == 0:
    # do stuff

```

---

<div class="post-metadata">

**Author:** ![BryanB](https://avatars.discourse-cdn.com/v4/letter/b/57b2e6/32.png) [@BryanB](https://forum.inductiveautomation.com/u/BryanB)\
**Post date:** [November 13, 2019, 9:21pm UTC](https://forum.inductiveautomation.com/t/value-changed-tag-event-data-quality/29922/6 "2019-11-13T21:21:40Z")

</div>

One other related thing - is there a good place to find the addition members of Ignition defined data types? For example, what’s the best way to figure out that “xxx.quality.good” even exists?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 13, 2019, 10:18pm UTC](https://forum.inductiveautomation.com/t/value-changed-tag-event-data-quality/29922/7 "2019-11-13T22:18:54Z")

</div>

Some general advice:

> [@User object functions](http://forum.inductiveautomation.com/t/user-object-functions/28211/4):
>
> Unfortunately, at some level (and it’s easy to do, so there’s no real way to tell you exactly when it will be) you “break out” of the expected areas where we’ve documented things and end up in the base Java classes that we’re using internally. Jython automatically wraps these up so they mostly seem like Python objects, so it’s hard to tell exactly when you get there. What I generally recommend, if you’re encountering something unfamiliar and want to see what you can do with it: Start with run…

More specifically:  
Printing the `type` of `currentValue.quality` (literally, just `print type(currentValue.quality)` will probably give you something like `com.inductiveautomation.ignition.common.sqltags.model.types.DataQuality` - the name of the Java class in our codebase. While I'd highly recommend the introspection tools I outline in the above post, you can also just go straight to the reference material (for example: [ignition 7.9.5 API](http://files.inductiveautomation.com/sdk/javadoc/ignition79/795/index.html)) and just look for `DataQuality` there. You'll see that [this class](http://files.inductiveautomation.com/sdk/javadoc/ignition79/795/com/inductiveautomation/ignition/common/sqltags/model/types/DataQuality.html) implements the underlying [`Quality`](http://files.inductiveautomation.com/sdk/javadoc/ignition79/795/com/inductiveautomation/ignition/common/model/values/Quality.html) interface, which is where the `isGood()` method is actually defined.
