# I am trying to add multiple tags in one piece of conveyor

**URL:** <https://forum.inductiveautomation.com/t/i-am-trying-to-add-multiple-tags-in-one-piece-of-conveyor/89934>\
**Category:** Ignition\
**Created:** [May 5, 2024, 11:58pm UTC](https://forum.inductiveautomation.com/t/i-am-trying-to-add-multiple-tags-in-one-piece-of-conveyor/89934 "2024-05-05T23:58:27Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![richard\_espinal](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@richard\_espinal](https://forum.inductiveautomation.com/u/richard_espinal)\
**Post date:** [May 5, 2024, 11:58pm UTC](https://forum.inductiveautomation.com/t/i-am-trying-to-add-multiple-tags-in-one-piece-of-conveyor/89934/1 "2024-05-05T23:58:27Z")

</div>

![20240505_194601](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/6/a6eb2f4caa4a4e88ca98d59ca5457807fea3f792.jpeg)

"For example, I want to be able to use a tag for `MF_LAT = 1` and all my conveyor sections will be flashing red, but when `UNIT_EN` is equal to 1, that will run my conveyor and everything will be green. And when `F_BK` = 1, then I can use another type of lighting like orange. In summary, running mode will be green with a tag for that, `MF_LAT` will be flashing red and that is another tag, and `F_BK` will be flashing orange and that is the third tag."

---

<div class="post-metadata">

**Author:** ![Patrick\_Fuller](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/patrick_fuller/32/61996_2.png) [@Patrick\_Fuller](https://forum.inductiveautomation.com/u/Patrick_Fuller)\
**Post date:** [May 6, 2024, 2:30am UTC](https://forum.inductiveautomation.com/t/i-am-trying-to-add-multiple-tags-in-one-piece-of-conveyor/89934/2 "2024-05-06T02:30:49Z")

</div>

I would create a UDT for your conveyor. Have your four tags in that UDT plus an additional expression tag and name that "state" and setup a nested if or case statement in that expression tag.

or you setup that state tag in the PLC and feed that up to Ignition.

You can have that state tag drive your front end styling. Assuming I understand what, you are trying to achieve.

---

<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:** [May 6, 2024, 2:52am UTC](https://forum.inductiveautomation.com/t/i-am-trying-to-add-multiple-tags-in-one-piece-of-conveyor/89934/3 "2024-05-06T02:52:02Z")

</div>

In the `case` statement, you might want to use `binEnc` to binary encode the various tags to then get your state

---

<div class="post-metadata">

**Author:** ![richard\_espinal](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@richard\_espinal](https://forum.inductiveautomation.com/u/richard_espinal)\
**Post date:** [May 6, 2024, 12:39pm UTC](https://forum.inductiveautomation.com/t/i-am-trying-to-add-multiple-tags-in-one-piece-of-conveyor/89934/4 "2024-05-06T12:39:54Z")

</div>

can you show me an example on how to do it ?

---

<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:** [May 6, 2024, 12:41pm UTC](https://forum.inductiveautomation.com/t/i-am-trying-to-add-multiple-tags-in-one-piece-of-conveyor/89934/5 "2024-05-06T12:41:07Z")

</div>

It's in the docs.

> **[binEnc | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/logic/binEnc)**
>
> Takes a list of booleans and treats them like the bits in a binary number.

---

<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:** [May 7, 2024, 12:02am UTC](https://forum.inductiveautomation.com/t/i-am-trying-to-add-multiple-tags-in-one-piece-of-conveyor/89934/6 "2024-05-07T00:02:21Z")

</div>

Something like this. I like to reuse binEnc in the compares so that I can easily relate the tags, but it'd be slightly less performant...

```python
case(binEnc({...MF_LAT}, {...F_BK}, {...AUX}, {...UNIT_EN}),
   binEnc(0,0,0,0), 0,
   binEnc(0,0,0,1), 1,
   binEnc(0,0,1,0), 2,
   binEnc(0,1,0,0), 3,
   binEnc(1,0,0,0), 4,
   -1
)

```

If the values should all be mutually exclusive as in the above case, then you could more simply use binEnum:

```python
binEnum({...MF_LAT}, {...F_BK}, {...AUX}, {...UNIT_EN})
// => Result would be 0, 1, 2, 3, 4 based on what tag is on.
//Precedence is given to the values in the order of the args. e.g. if arg2 and 3 are on, arg2 wins and will result in 2

```

---

<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:** [May 7, 2024, 12:07am UTC](https://forum.inductiveautomation.com/t/i-am-trying-to-add-multiple-tags-in-one-piece-of-conveyor/89934/7 "2024-05-07T00:07:52Z")

</div>

Don't mind me, just making a mental note to support binary literals in the expression language at some point...

---

<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:** [May 7, 2024, 12:16am UTC](https://forum.inductiveautomation.com/t/i-am-trying-to-add-multiple-tags-in-one-piece-of-conveyor/89934/8 "2024-05-07T00:16:06Z")

</div>

Hex literals too 🙂

---

<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:** [May 7, 2024, 2:18am UTC](https://forum.inductiveautomation.com/t/i-am-trying-to-add-multiple-tags-in-one-piece-of-conveyor/89934/9 "2024-05-07T02:18:17Z")

</div>

Hex literals already work? 0x124 worked for me 🙂
