# Get tag quality in an expression

**URL:** <https://forum.inductiveautomation.com/t/get-tag-quality-in-an-expression/42711>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [January 28, 2021, 6:03pm UTC](https://forum.inductiveautomation.com/t/get-tag-quality-in-an-expression/42711 "2021-01-28T18:03:11Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![wpmccormick](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wpmccormick/32/13940_2.png) [@wpmccormick](https://forum.inductiveautomation.com/u/wpmccormick)\
**Post date:** [January 28, 2021, 6:03pm UTC](https://forum.inductiveautomation.com/t/get-tag-quality-in-an-expression/42711/1 "2021-01-28T18:03:11Z")

</div>

I’m looking for a way to tell if a tag is enabled or disabled in an expression, and bind that to a property.

I want to control a button visibility based on the tag’s quality. If the tag quality is disabled, then not visible.

isGood doesn’t seem to work and I don’t see any way to get to the quality (in an expression) directly.

---

<div class="post-metadata">

**Author:** ![WillMT10](https://avatars.discourse-cdn.com/v4/letter/w/7feea3/32.png) [@WillMT10](https://forum.inductiveautomation.com/u/WillMT10)\
**Post date:** [January 28, 2021, 6:11pm UTC](https://forum.inductiveautomation.com/t/get-tag-quality-in-an-expression/42711/2 "2021-01-28T18:11:05Z")

</div>

Not sure this is the best option but you could reference the tag Quality meta property directly:

```auto
{[default]path/to/tag.Quality}

```

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [January 28, 2021, 6:23pm UTC](https://forum.inductiveautomation.com/t/get-tag-quality-in-an-expression/42711/3 "2021-01-28T18:23:05Z")

</div>

@WillMT10 suggestion seems to be the easiest method. Just use an expression binding then use the tag browser to select the tag’s quality meta-property, nothing else needed unless you need it as a boolean then

```auto
if({[default]path/to/tag.Quality} = 'Disabled',0,1)
```

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [January 28, 2021, 6:26pm UTC](https://forum.inductiveautomation.com/t/get-tag-quality-in-an-expression/42711/4 "2021-01-28T18:26:51Z")

</div>

`{[default]path/to/tag.Quality} != 'Disabled'` would probably suffice.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [January 28, 2021, 6:29pm UTC](https://forum.inductiveautomation.com/t/get-tag-quality-in-an-expression/42711/5 "2021-01-28T18:29:38Z")

</div>

Syntactically shorter, but more confusing in my opinion

---

<div class="post-metadata">

**Author:** ![wpmccormick](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wpmccormick/32/13940_2.png) [@wpmccormick](https://forum.inductiveautomation.com/u/wpmccormick)\
**Post date:** [January 28, 2021, 6:32pm UTC](https://forum.inductiveautomation.com/t/get-tag-quality-in-an-expression/42711/6 "2021-01-28T18:32:27Z")

</div>

thanks. So the complete expression that works is:

tag({template/tag/path}+’/some/sub/tag.Quality’) != ‘Disabled’

---

<div class="post-metadata">

**Author:** ![WillMT10](https://avatars.discourse-cdn.com/v4/letter/w/7feea3/32.png) [@WillMT10](https://forum.inductiveautomation.com/u/WillMT10)\
**Post date:** [January 28, 2021, 6:41pm UTC](https://forum.inductiveautomation.com/t/get-tag-quality-in-an-expression/42711/7 "2021-01-28T18:41:44Z")

</div>

[From one of the many @pturmel teachings](http://forum.inductiveautomation.com/t/binding-to-custom-component-methods/19245/9), I’d recommend creating a custom property that is an indirect tag binding to `{template/tag/path}+’/some/sub/tag.Quality’`. Then change your expression to

```auto
{new_custom_property} != 'Disabled'

```

---

<div class="post-metadata">

**Author:** ![wpmccormick](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wpmccormick/32/13940_2.png) [@wpmccormick](https://forum.inductiveautomation.com/u/wpmccormick)\
**Post date:** [January 28, 2021, 6:46pm UTC](https://forum.inductiveautomation.com/t/get-tag-quality-in-an-expression/42711/8 "2021-01-28T18:46:37Z")

</div>

Seems to make sense, not having having that hard-coded in an expression binding. But what problem/issue does that solve? Can you site a use case doing it one way and the other?

---

<div class="post-metadata">

**Author:** ![WillMT10](https://avatars.discourse-cdn.com/v4/letter/w/7feea3/32.png) [@WillMT10](https://forum.inductiveautomation.com/u/WillMT10)\
**Post date:** [January 28, 2021, 6:48pm UTC](https://forum.inductiveautomation.com/t/get-tag-quality-in-an-expression/42711/9 "2021-01-28T18:48:17Z")

</div>

From that same thread I linked above:

> [@Binding to Custom Component Methods](https://forum.inductiveautomation.com/t/binding-to-custom-component-methods/19245/11):
>
> When you use the tag() expression, it has to go get that value for any re-evaluation of that expression, including an actual tag value change. When you break it out to an indirect binding, that binding will only make a request when the path changes, and sits waiting just for tag changes otherwise. The expression will re-evaluate on the new tag property change, but other reevaluations will only grab the subscribed tag value. Much more efficient.

If you were to use `tag()` functions extensively, it can get A LOT more sluggish than using indirect tag bindings (learned this the hard way...).

---

<div class="post-metadata">

**Author:** ![wpmccormick](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wpmccormick/32/13940_2.png) [@wpmccormick](https://forum.inductiveautomation.com/u/wpmccormick)\
**Post date:** [January 28, 2021, 6:51pm UTC](https://forum.inductiveautomation.com/t/get-tag-quality-in-an-expression/42711/10 "2021-01-28T18:51:09Z")

</div>

Thanks. Had I only followed your link I could have answered that myself. Thanks for being polite.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [January 30, 2021, 3:19am UTC](https://forum.inductiveautomation.com/t/get-tag-quality-in-an-expression/42711/11 "2021-01-30T03:19:27Z")

</div>

Just note, in v8 the quality strings have changed. Disabled becomes Bad\_Disabled

> [@Undocumented changes when migrating from v7 to v8](http://forum.inductiveautomation.com/t/undocumented-changes-when-migrating-from-v7-to-v8/38044):
>
> Just some items I’ve found during v7 to v8 upgrades that may not be documented (some of them might be) and can cause hiccups (and quite a bit of work, relatively speaking!). The official guide to upgrading from IA is [here](https://docs.inductiveautomation.com/display/DOC81/Ignition+8+Upgrade+Guide). Tags: UDT v7 property UDTParentType has been renamed in v8 to TypeId Tag quality string values have changed. E.g. EDITED FOR 8.1.10 below 8.1.10 “Not Found” ==\> “Bad\_NotFound”; “Disabled” ==\> “Bad\_Disabled”; 8.1.10 and above “Bad\_NotFound(Error description…)”, “Bad\_ErrorC…

Also, IA have always recommended against using magic strings to compare quality, as you can see, they may be changed in future versions. Although there's no alternative at the moment in the expression language if you want to check for a specific quality. `isGood({[default]path/to/tag})` should work, stealing Jordan's tag path from his post. Note: don't include the ".Quality" on the end, as the quality when reading the quality of a tag itself will always be good

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [January 30, 2021, 2:34pm UTC](https://forum.inductiveautomation.com/t/get-tag-quality-in-an-expression/42711/12 "2021-01-30T14:34:20Z")

</div>

In v8, you actually get an Enabled property, going back to the OP.
