# Scripting Help - Device Conditions

**URL:** <https://forum.inductiveautomation.com/t/scripting-help-device-conditions/28645>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [September 29, 2019, 1:07pm UTC](https://forum.inductiveautomation.com/t/scripting-help-device-conditions/28645 "2019-09-29T13:07:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jgraham](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@jgraham](https://forum.inductiveautomation.com/u/jgraham)\
**Post date:** [September 29, 2019, 1:07pm UTC](https://forum.inductiveautomation.com/t/scripting-help-device-conditions/28645/1 "2019-09-29T13:07:50Z")

</div>

I am trying to create the following conditions with an associated value under a UDT expression tag.

1. Conditions -Value 0 - Motor Not Running && Interlocks/Permissives Not Met
2. Conditions - Value 1 - Motor Not Running && Interlocks/Permissives Met
3. Conditions - Value 2 - Not Running && Faulted
4. Conditions - Value 3 - Running && Not to Speed
5. Conditions - Value 4 - Running && Up to Speed

These values will be used to associate a templates triangle fill color…

Any help would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [September 29, 2019, 5:23pm UTC](https://forum.inductiveautomation.com/t/scripting-help-device-conditions/28645/2 "2019-09-29T17:23:13Z")

</div>

Create an Expression tag named Status and use the binEnum expression and then set the color to that tag from the UDT.

[https://docs.inductiveautomation.com/display/DOC80/binEnum](https://docs.inductiveautomation.com/display/DOC80/binEnum)

`binEnum({Motor Not Running}&&{Interlocks/Permissives Not Met},{Motor Not Running}&&{Interlocks/Permissives Met},{Not Running}&&{Faulted},{Running}&&{Not to Speed},{Running}&&{Up to Speed})`

---

<div class="post-metadata">

**Author:** ![jgraham](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@jgraham](https://forum.inductiveautomation.com/u/jgraham)\
**Post date:** [September 29, 2019, 5:46pm UTC](https://forum.inductiveautomation.com/t/scripting-help-device-conditions/28645/3 "2019-09-29T17:46:11Z")

</div>

I did a work around and created a several expression tags with conditions in each to mimic an index. Then I used the tag value change event in each to set the index number in the “Status” tag. After I had a value I could use it to drive set color. It was a little more work then what the binEnum will do and way more slick and clean.

Thanks for the help! I plan on using that next time around for sure…

---

<div class="post-metadata">

**Author:** ![jgraham](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@jgraham](https://forum.inductiveautomation.com/u/jgraham)\
**Post date:** [September 29, 2019, 5:47pm UTC](https://forum.inductiveautomation.com/t/scripting-help-device-conditions/28645/4 "2019-09-29T17:47:32Z")

</div>

I meant to say the binEnum is way more slick…not my workaround!
