# Show/Hide button based on value of tag

**URL:** <https://forum.inductiveautomation.com/t/show-hide-button-based-on-value-of-tag/60631>\
**Category:** Ignition\
**Tags:** scripting, perspective\
**Created:** [June 10, 2022, 6:14pm UTC](https://forum.inductiveautomation.com/t/show-hide-button-based-on-value-of-tag/60631 "2022-06-10T18:14:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raymond\_Sipes](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Raymond\_Sipes](https://forum.inductiveautomation.com/u/Raymond_Sipes)\
**Post date:** [June 10, 2022, 6:14pm UTC](https://forum.inductiveautomation.com/t/show-hide-button-based-on-value-of-tag/60631/1 "2022-06-10T18:14:14Z")

</div>

Hello!

I have a button that should be hidden unless the value of a tag is greater than 0. This is the script I have on the onCompositionEnd event:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/0/d071103f7f13ae7953c2bebde48524e18b7da67f.png)  
Not too sure how to move forward from here, any help would be great!

Thank you!

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [June 10, 2022, 6:21pm UTC](https://forum.inductiveautomation.com/t/show-hide-button-based-on-value-of-tag/60631/2 "2022-06-10T18:21:57Z")

</div>

I would create a custom property bound to the tag, then use an expression on the visible/display property of the button.

---

<div class="post-metadata">

**Author:** ![Raymond\_Sipes](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Raymond\_Sipes](https://forum.inductiveautomation.com/u/Raymond_Sipes)\
**Post date:** [June 10, 2022, 6:32pm UTC](https://forum.inductiveautomation.com/t/show-hide-button-based-on-value-of-tag/60631/3 "2022-06-10T18:32:40Z")

</div>

Should I create the custom property on the button that I want hidden or the field with the tag data?

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [June 10, 2022, 6:34pm UTC](https://forum.inductiveautomation.com/t/show-hide-button-based-on-value-of-tag/60631/4 "2022-06-10T18:34:50Z")

</div>

I guess that depends on if the custom property will be used elsewhere. I think I would place in the root of the view the button will be. There are several ways to approach this.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 10, 2022, 6:37pm UTC](https://forum.inductiveautomation.com/t/show-hide-button-based-on-value-of-tag/60631/5 "2022-06-10T18:37:10Z")

</div>

You are making this too hard. Just use a tag binding on `meta.visible` to that tag. Non-zero automatically maps to true.

---

<div class="post-metadata">

**Author:** ![Raymond\_Sipes](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Raymond\_Sipes](https://forum.inductiveautomation.com/u/Raymond_Sipes)\
**Post date:** [June 10, 2022, 6:40pm UTC](https://forum.inductiveautomation.com/t/show-hide-button-based-on-value-of-tag/60631/6 "2022-06-10T18:40:14Z")

</div>

Welp, you are definitely right on that! I was making it way too difficult, binding it to that tags value did the trick! Thank you both for the help!

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 10, 2022, 10:31pm UTC](https://forum.inductiveautomation.com/t/show-hide-button-based-on-value-of-tag/60631/7 "2022-06-10T22:31:43Z")

</div>

Tips:  
Your (now redundant) code should use `.visible = False` and `.visible = True` for Python boolean.

Posting code is better than pictures of code as we can copy and edit it in our answers. Use the `</>` code formatting button when posting code.

---

<div class="post-metadata">

**Author:** ![Raymond\_Sipes](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@Raymond\_Sipes](https://forum.inductiveautomation.com/u/Raymond_Sipes)\
**Post date:** [June 12, 2022, 10:39pm UTC](https://forum.inductiveautomation.com/t/show-hide-button-based-on-value-of-tag/60631/8 "2022-06-12T22:39:41Z")

</div>

Will do, thank you for the valuable feedback!
