# Hide components with condition

**URL:** <https://forum.inductiveautomation.com/t/hide-components-with-condition/68495>\
**Category:** Ignition\
**Created:** [January 11, 2023, 5:46pm UTC](https://forum.inductiveautomation.com/t/hide-components-with-condition/68495 "2023-01-11T17:46:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pedro\_Oliveira](https://avatars.discourse-cdn.com/v4/letter/p/43a26b/32.png) [@Pedro\_Oliveira](https://forum.inductiveautomation.com/u/Pedro_Oliveira)\
**Post date:** [January 11, 2023, 5:46pm UTC](https://forum.inductiveautomation.com/t/hide-components-with-condition/68495/1 "2023-01-11T17:46:25Z")

</div>

HI, so i have this idea that i add lights (for example) and i have a button for that light, and then a OPC TAG connected to that button. Now, i want this button to disappear in case the OPC Tag is not working (bad connection) and if it is connected then reapers.  
Does anyone knows how it can be done?

---

<div class="post-metadata">

**Author:** ![etknorr](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/etknorr/32/33184_2.png) [@etknorr](https://forum.inductiveautomation.com/u/etknorr)\
**Post date:** [January 11, 2023, 6:43pm UTC](https://forum.inductiveautomation.com/t/hide-components-with-condition/68495/2 "2023-01-11T18:43:55Z")

</div>

# Perspective

Use a tag binding on the props.position.display property with an expression transform to see if the tag is good.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/0/c0ce3c54fb81e42756aea659b79c58e6444e199c.png)

# Vision

Use an expression binding on Common.Visible property of the button with an expression like:

> isGood([yourProvide]path/to/tag)

---

<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:** [January 11, 2023, 6:55pm UTC](https://forum.inductiveautomation.com/t/hide-components-with-condition/68495/4 "2023-01-11T18:55:52Z")

</div>

> [@Ricky](#):
>
> if({'tag path'.quality} \< 192, False, True)

The advice from IA on [Using tag data quality to set tag value - #5 by PGriffith](https://forum.inductiveautomation.com/t/using-tag-data-quality-to-set-tag-value/59329/5) is to use the `isGood()` function rather than checking a range of values. It's also much shorter and more clear what the code is doing.

Welcome to the forum!

---

<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:** [January 11, 2023, 7:04pm UTC](https://forum.inductiveautomation.com/t/hide-components-with-condition/68495/5 "2023-01-11T19:04:50Z")

</div>

> [@etknorr](#):
>
> Use a tag binding on the props.position.display property with an expression transform to see if the tag is good.

You don't need two steps; you can just put the tag property directly in the expression, the same as Vision. It's likely faster to do so.

---

<div class="post-metadata">

**Author:** ![Pedro\_Oliveira](https://avatars.discourse-cdn.com/v4/letter/p/43a26b/32.png) [@Pedro\_Oliveira](https://forum.inductiveautomation.com/u/Pedro_Oliveira)\
**Post date:** [January 16, 2023, 4:02pm UTC](https://forum.inductiveautomation.com/t/hide-components-with-condition/68495/6 "2023-01-16T16:02:37Z")

</div>

An extra question, if i may: I sometimes bind the visible tag but sometime, when i have more buttons that hides/shows the same component that is already bind, i use the script "self.getSibling"Component".meta.visible = 1 or 0. And it works fine.  
But i am trying to figure it out how to make this to another view. Like, a button that if it pressed, then when i nav to another view and certain component will be hidden or shown.  
Do you happen to now how the function to call other components and props in another views works?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [January 16, 2023, 4:07pm UTC](https://forum.inductiveautomation.com/t/hide-components-with-condition/68495/7 "2023-01-16T16:07:37Z")

</div>

> [@Pedro\_Oliveira](#):
>
> Do you happen to now how the function to call other components and props in another views works?

If the other view is open, then a message handler can be used.

If you are opening the view with the button, then you would need to send a parameter to the view to hide/show the components.

---

<div class="post-metadata">

**Author:** ![Pedro\_Oliveira](https://avatars.discourse-cdn.com/v4/letter/p/43a26b/32.png) [@Pedro\_Oliveira](https://forum.inductiveautomation.com/u/Pedro_Oliveira)\
**Post date:** [January 16, 2023, 4:50pm UTC](https://forum.inductiveautomation.com/t/hide-components-with-condition/68495/9 "2023-01-16T16:50:05Z")

</div>

The view is not open.  
Context: House model, i have various nav buttons on "Home Page" that navigate to each select room (ex: kitchen, garage, Bedrooms, etc). Now, when i nav to "Bedrooms Page" i have 3 other nav buttons referring to each bedroom (ex: bedroom 1, bedroom 2 and bedroom 3).  
What i want to do, is in the home page, create a slide with 1, 2, 3 values, and i create a script with an "if" and accordingly to witch number the slider is and it correspond to the number of bedrooms there are available. So if the slider is on 1, only the button "Bedroom 1" will show up when i navigate to "Bedrooms Page", and if the slider is on 2, then the buttons "Bedroom 1" and "Bedroom 2" will show up.  
Problem: I dont know how to change other views properties/metas, only getSibling/parent/getChild that only work on the same view.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [January 16, 2023, 6:20pm UTC](https://forum.inductiveautomation.com/t/hide-components-with-condition/68495/10 "2023-01-16T18:20:23Z")

</div>

You would pass in the "Number of Bedrooms" as a parameter when you navigate to the view.

You can do that with `system.perspective.navigate()`

[https://docs.inductiveautomation.com/display/DOC81/system.perspective.navigate](https://docs.inductiveautomation.com/display/DOC81/system.perspective.navigate)

---

<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:** [January 16, 2023, 11:22pm UTC](https://forum.inductiveautomation.com/t/hide-components-with-condition/68495/11 "2023-01-16T23:22:29Z")

</div>

> [@Pedro\_Oliveira](#):
>
> Do you happen to now how the function to call other components and props in another views works?

You cannot. Views do not have access to components of other views. You must use bidirectional view parameters or bidirectional bindings to session properties or messaging.
