# Conditional Expression Statement - Visibility Binding

**URL:** <https://forum.inductiveautomation.com/t/conditional-expression-statement-visibility-binding/108122>\
**Category:** Ignition\
**Tags:** vision, ignition81\
**Created:** [July 3, 2025, 7:11pm UTC](https://forum.inductiveautomation.com/t/conditional-expression-statement-visibility-binding/108122 "2025-07-03T19:11:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![warren](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@warren](https://forum.inductiveautomation.com/u/warren)\
**Post date:** [July 3, 2025, 7:11pm UTC](https://forum.inductiveautomation.com/t/conditional-expression-statement-visibility-binding/108122/1 "2025-07-03T19:11:23Z")

</div>

I have a few visuals I want to toggle depending on machine states, which I have setup without any issue. My current problem is that I need to find an expression statement to control visibility when multiple tag states are considered:

Tag 1 = {[default]Internal/HMI\_Pump}  
Tag 2 = {[default]Internal/Process/Machine Steps/Pump/Status\_Ready}  
Tag 3 = {[default]Internal/Process/Start Process}

Essentially Tag 1 is triggering the visibility because it's a machine mode. The issue is I need to add a section into the visibility expression to turn off the visibility. I need the visibility to change when the process is complete (Tag 2 enabled), but I want this Tag 2 condition to only be evaluated while Tag 3 is active.

If {[default]Internal/HMI\_Pump} is turning it on, what would be the logic to include after to disable the visibility?

---

<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:** [July 3, 2025, 7:37pm UTC](https://forum.inductiveautomation.com/t/conditional-expression-statement-visibility-binding/108122/2 "2025-07-03T19:37:28Z")

</div>

Write a truth table.

```python
Tag 1 Tag 2 Tag 3 Visible
    0 0 0 ?
    1 0 0 ?
    0 1 0 ?
    1 1 0 ?
    0 0 1 ?
    1 0 1 ?
    0 1 1 ?
    1 1 1 ?

```

It will clarify your thinking and help us no end.  
Copy and paste my table into your question to edit. If it doesn't preserve the formatting then select the text and hit the \</\> button.

The solution is likely to be something of the form,

```python
case(
    binEnc({tag1}, {tag2}, {tag3}), // Replace with proper tag paths.
    0, False, // I haven't worked out what you actually need here.
    1, False,
    2, True,
    3, True,
    4, False,
    5, False,
    6, True,
    7, False,
    False
)

```

See [binEnc | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/logic/binEnc) and [case | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/logic/case),

---

<div class="post-metadata">

**Author:** ![warren](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@warren](https://forum.inductiveautomation.com/u/warren)\
**Post date:** [July 3, 2025, 8:57pm UTC](https://forum.inductiveautomation.com/t/conditional-expression-statement-visibility-binding/108122/4 "2025-07-03T20:57:21Z")

</div>

> [@Transistor](#):
>
> ```python
> Tag 1 Tag 2 Tag 3 Visible
> 0 0 0 ?
> 1 0 0 ?
> 0 1 0 ?
> 1 1 0 ?
> 0 0 1 ?
> 1 0 1 ?
> 0 1 1 ?
> 1 1 1 ?
> 
> ```

Here's the logic table:

```
1 0 0 Visible - (Initial running state of machine)
1 0 1 Visible - (Secondary process triggered = Tag 3)
1 1 0 Visible - (Initial running state finishes = Tag 2 active)
1 1 1 Invisible - (Initial state running, secondary process triggered, waiting for initial state to complete)

```

The last line would be the state where the visibility of this component finally is released, and the next component visibility becomes active and is overlayed.

---

<div class="post-metadata">

**Author:** ![robertm](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@robertm](https://forum.inductiveautomation.com/u/robertm)\
**Post date:** [July 3, 2025, 9:04pm UTC](https://forum.inductiveautomation.com/t/conditional-expression-statement-visibility-binding/108122/5 "2025-07-03T21:04:12Z")

</div>

Thats not a complete truth table. Are you not familiar with Karnaugh maps?

Thr logic would be trivial after the reduction from a karnaugh map.

---

<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:** [July 3, 2025, 9:12pm UTC](https://forum.inductiveautomation.com/t/conditional-expression-statement-visibility-binding/108122/6 "2025-07-03T21:12:23Z")

</div>

I think you just need,

```python
case(
    binEnc({tag1}, {tag2}, {tag3}), // Replace with proper tag paths.
    1, True,
    5, True,
    6, True,
    False
)

```

---

<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:** [July 3, 2025, 9:56pm UTC](https://forum.inductiveautomation.com/t/conditional-expression-statement-visibility-binding/108122/7 "2025-07-03T21:56:27Z")

</div>

I wouldn't do it this way if it was me, that's far too hard to diagnose. I would be using the logic expression from the result of the karnaugh map, (if it's really that complicated), or otherwise just writing it stepping through logically.

Eg (this is just random)

```python
({tag1} && !{tag2}) ||
({tag3} && {tag2}) 

```

---

<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:** [July 4, 2025, 1:33am UTC](https://forum.inductiveautomation.com/t/conditional-expression-statement-visibility-binding/108122/8 "2025-07-04T01:33:45Z")

</div>

Assuming that the component is always invisible when tag 1 is false, then this should work:

```python
{Tag 1} && !({Tag 2} && {Tag 3})

```

---

<div class="post-metadata">

**Author:** ![warren](https://avatars.discourse-cdn.com/v4/letter/w/97f17d/32.png) [@warren](https://forum.inductiveautomation.com/u/warren)\
**Post date:** [July 4, 2025, 2:09am UTC](https://forum.inductiveautomation.com/t/conditional-expression-statement-visibility-binding/108122/9 "2025-07-04T02:09:09Z")

</div>

> [@Transistor](#):
>
> ```python
> case(
> binEnc({tag1}, {tag2}, {tag3}), // Replace with proper tag paths.
> 1, True,
> 5, True,
> 6, True,
> False
> )
> 
> ```

Thanks for this. It's working except under one condition. When Tag 3 is false and Tag 2 comes on, it goes away.. which of these lines should I edit for this?

---

<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:** [July 4, 2025, 3:12am UTC](https://forum.inductiveautomation.com/t/conditional-expression-statement-visibility-binding/108122/10 "2025-07-04T03:12:29Z")

</div>

> [@warren](#):
>
> which of these lines should I edit for this?

The fact youre asking this question only strengthens my argument that a case here with binenc is less obvious and hard to diagnose.

If you do want to use case with binenc, I prefer to use binenc as well for the values, but it's less efficient..  
e.g.

```python
case(binEnc({tag1}, {tag2}, {tag3})
	,binEnc(0,0,1), 1
	,binEnc(1,0,1), 2
	,binEnc(1,1,0), 3
	,-1
)

```

Then at least you can see it visually

---

<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:** [July 4, 2025, 7:22am UTC](https://forum.inductiveautomation.com/t/conditional-expression-statement-visibility-binding/108122/11 "2025-07-04T07:22:20Z")

</div>

> [@warren](#):
>
> which of these lines should I edit for this?

```python
Tag1 Tag2 Tag3 binEnc
+1 +2 +4 Decimal
---- ---- ---- -------
1 0 0 1 Visible - (Initial running state of machine)
1 0 1 5 Visible - (Secondary process triggered = Tag 3)
1 1 0 6 Visible - (Initial running state finishes = Tag 2 active)

```

It's simply binary to decimal conversion. Each bit has a weight of 1, 2, 4, 8, etc. Add in whatever other conditions you need.
