# Trying to link a bool state to the bite of a integer

**URL:** <https://forum.inductiveautomation.com/t/trying-to-link-a-bool-state-to-the-bite-of-a-integer/65825>\
**Category:** Ignition\
**Created:** [October 28, 2022, 7:55pm UTC](https://forum.inductiveautomation.com/t/trying-to-link-a-bool-state-to-the-bite-of-a-integer/65825 "2022-10-28T19:55:55Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_Dubuc](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@Simon\_Dubuc](https://forum.inductiveautomation.com/u/Simon_Dubuc)\
**Post date:** [October 28, 2022, 7:55pm UTC](https://forum.inductiveautomation.com/t/trying-to-link-a-bool-state-to-the-bite-of-a-integer/65825/1 "2022-10-28T19:55:55Z")

</div>

Hi, I am trying to link the state of many boolean to each bite of an integer located in my UDT tag but it seem that i cannot target each bit. I can only taget the integer in its integrity. Is there a way to link the state of a boolean to the bite of an integer that is located in a UDT?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 28, 2022, 7:57pm UTC](https://forum.inductiveautomation.com/t/trying-to-link-a-bool-state-to-the-bite-of-a-integer/65825/2 "2022-10-28T19:57:27Z")

</div>

An expression or derived tag using the `getBit` or `getBit`/`setBit` expression functions could work. The latter scenario is probably prone to race conditions, though, so if you only need to read the bits that would be ideal.

[https://docs.inductiveautomation.com/display/DOC81/getBit](https://docs.inductiveautomation.com/display/DOC81/getBit)

---

<div class="post-metadata">

**Author:** ![Simon\_Dubuc](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@Simon\_Dubuc](https://forum.inductiveautomation.com/u/Simon_Dubuc)\
**Post date:** [October 28, 2022, 7:58pm UTC](https://forum.inductiveautomation.com/t/trying-to-link-a-bool-state-to-the-bite-of-a-integer/65825/3 "2022-10-28T19:58:20Z")

</div>

Thanks. I will try it rigt now

---

<div class="post-metadata">

**Author:** ![Simon\_Dubuc](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@Simon\_Dubuc](https://forum.inductiveautomation.com/u/Simon_Dubuc)\
**Post date:** [October 28, 2022, 8:09pm UTC](https://forum.inductiveautomation.com/t/trying-to-link-a-bool-state-to-the-bite-of-a-integer/65825/4 "2022-10-28T20:09:07Z")

</div>

Thank you it is working well to read but i would neef to be able to write into my integer as well. Is there an other fonction that would work?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 28, 2022, 8:10pm UTC](https://forum.inductiveautomation.com/t/trying-to-link-a-bool-state-to-the-bite-of-a-integer/65825/5 "2022-10-28T20:10:41Z")

</div>

That would be the `setBit` and derived tag approach I mentioned.

What kind of tag is the source tag? This isn't the ideal approach if you need to write. If it's an OPC Tag then it would be better if the server you're connected to supports a syntax for bit addressing instead.

---

<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:** [October 28, 2022, 8:19pm UTC](https://forum.inductiveautomation.com/t/trying-to-link-a-bool-state-to-the-bite-of-a-integer/65825/6 "2022-10-28T20:19:54Z")

</div>

> [@Simon\_Dubuc](#):
>
> ... to each bite ...

Tips:  
**bit** = **b** inary dig **it**.  
**byte** = a group of bits - usually 8.  
**bite** = cut into or through something using teeth!

---

<div class="post-metadata">

**Author:** ![Simon\_Dubuc](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@Simon\_Dubuc](https://forum.inductiveautomation.com/u/Simon_Dubuc)\
**Post date:** [October 28, 2022, 8:23pm UTC](https://forum.inductiveautomation.com/t/trying-to-link-a-bool-state-to-the-bite-of-a-integer/65825/7 "2022-10-28T20:23:06Z")

</div>

Ok thanks! Each bool are from different object in my window.

---

<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:** [October 28, 2022, 9:48pm UTC](https://forum.inductiveautomation.com/t/trying-to-link-a-bool-state-to-the-bite-of-a-integer/65825/8 "2022-10-28T21:48:16Z")

</div>

If they aren't connected to an OPC device, just use actual boolean tags. Separate ones.

---

<div class="post-metadata">

**Author:** ![Simon\_Dubuc](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@Simon\_Dubuc](https://forum.inductiveautomation.com/u/Simon_Dubuc)\
**Post date:** [October 31, 2022, 12:39pm UTC](https://forum.inductiveautomation.com/t/trying-to-link-a-bool-state-to-the-bite-of-a-integer/65825/9 "2022-10-31T12:39:24Z")

</div>

Thank you it worked well!
