# Using BinEnum expression

**URL:** <https://forum.inductiveautomation.com/t/using-binenum-expression/10535>\
**Category:** Ignition\
**Created:** [September 28, 2015, 2:29pm UTC](https://forum.inductiveautomation.com/t/using-binenum-expression/10535 "2015-09-28T14:29:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![NLR.Lyle](https://avatars.discourse-cdn.com/v4/letter/n/54ee81/32.png) [@NLR.Lyle](https://forum.inductiveautomation.com/u/NLR.Lyle)\
**Post date:** [September 28, 2015, 2:29pm UTC](https://forum.inductiveautomation.com/t/using-binenum-expression/10535/1 "2015-09-28T14:29:26Z")

</div>

I’ve got an actuated valve that has a tag for open and a tag for closed. If it is closed and you push the button for open, both tags for open and closed are = 1 until limit switch is hit, changing the closed tag value to 0.

I am trying to make an expression where a multistate will be red when closed tag =1 and green when opened tag = 1, and flash green/red and display “operating” when both tags = 1. Is it possible to do this?

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [September 28, 2015, 4:39pm UTC](https://forum.inductiveautomation.com/t/using-binenum-expression/10535/2 "2015-09-28T16:39:23Z")

</div>

The binEnc expression should do just that - pass it the two tags and you’ll get 0/1/2/3 as a result

---

<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:** [September 28, 2015, 4:41pm UTC](https://forum.inductiveautomation.com/t/using-binenum-expression/10535/3 "2015-09-28T16:41:16Z")

</div>

Yes. A simple label can do this with a few expressions. First, bind its ‘text’ property to an expression like:`if({[Client]Opened} && {[Client]Closed}, "Operating", "")`That’ll make the text only appear when both bits are true. Then create a custom property “Blink” and bind it to an expression like:`dateExtract(now(250), 'second') % 2`That’ll make it toggle every second. Finally, set the “Fill Background” property, and bind the background color to another expression, like:`if({[Client]Opened},
  if({[Client]Closed},
    if({Root Container.Label.Blink}, "red", "green"),
    "green"),
  if({[Client]Closed}, "red", "orange"))`Note the “orange” at the end. That allows an operator to see a device failure that leaves both signals off.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [September 28, 2015, 4:57pm UTC](https://forum.inductiveautomation.com/t/using-binenum-expression/10535/4 "2015-09-28T16:57:22Z")

</div>

Phil’s solution would work, but I think it would be a lot easier to:

1. Make an integer custom property called “state”, bind it to “binEnc({tag1}, {tag2})”
2. Use Styles feature to drive color/text/blinking etc

---

<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:** [September 28, 2015, 5:56pm UTC](https://forum.inductiveautomation.com/t/using-binenum-expression/10535/5 "2015-09-28T17:56:36Z")

</div>

Yeah, Styles. Can you tell I don’t use them often? 🙂

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [September 28, 2015, 5:59pm UTC](https://forum.inductiveautomation.com/t/using-binenum-expression/10535/6 "2015-09-28T17:59:57Z")

</div>

Yes, I got that impression!
