# Multi State Button controlling to separate boolean tags

**URL:** <https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [February 28, 2024, 4:09pm UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524 "2024-02-28T16:09:58Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lance\_Moore](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@Lance\_Moore](https://forum.inductiveautomation.com/u/Lance_Moore)\
**Post date:** [February 28, 2024, 4:09pm UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/1 "2024-02-28T16:09:58Z")

</div>

Hello , I'm trying to create a multi state button using to boolean tags:  
1st one is Auto m0015  
2nd one is Hand m0016  
What I'm looking for is a way to make the Hand button to control the Hand Boolean and the Auto button to control the Auto Boolean and the off button to release either one of them when pushed. I would also like the indicator value to change according likewise also. not sure where to start. I'm pretty new to Ignition Perspective. Thanks in advance.  
Lance Moore

---

<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:** [February 28, 2024, 4:14pm UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/2 "2024-02-28T16:14:17Z")

</div>

I would strongly recommend you **NOT** use separate booleans. Use a short integer instead, where the low bit of the integer is "Hand" and the next bit is "Auto". In the buttons, just write `0`, `1`, or `2` to the integer as appropriate.

Separate tags introduces races conditions that can leave you in an invalid state, or pass through an invalid state briefly. The latter can really screw up PLC code.

---

<div class="post-metadata">

**Author:** ![Lance\_Moore](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@Lance\_Moore](https://forum.inductiveautomation.com/u/Lance_Moore)\
**Post date:** [February 29, 2024, 12:17am UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/3 "2024-02-29T00:17:23Z")

</div>

Ok, I'm not sure where to go from here. I,m using an IDEC plc.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/e/4ec06fbe9baf2d7f935261f0e8483fe2bdb687c9.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/8/a85207e2c82500e93d4e44b1f9188f267f54673a.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/b/5b37018ab08fa1909ccc4ba09c6e714cc82aa636.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/3/83eccf337ac6157514351e5bacf480fbf79aaf4e.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/b/bb0d48cfc7d005f9303ad67979e943394d789891.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/4/0408f3ce34a60f199326ab619161a8145af663af.png)

---

<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:** [February 29, 2024, 12:21am UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/4 "2024-02-29T00:21:18Z")

</div>

I don't recognize `D1500`. Are you using Modbus with address mappings? (You should be using manual modbus addressing, generally.)

---

<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:** [February 29, 2024, 12:33am UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/5 "2024-02-29T00:33:12Z")

</div>

Aside from the recommendation to not use address mapping, is there an error in the Gateway logs?

From the screenshots it looks like the tag is reading without error, which might mean the write is failing because this device doesn't support the function code necessary to write to bits within words.

---

<div class="post-metadata">

**Author:** ![Lance\_Moore](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@Lance\_Moore](https://forum.inductiveautomation.com/u/Lance_Moore)\
**Post date:** [February 29, 2024, 7:11pm UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/6 "2024-02-29T19:11:52Z")

</div>

D = Data Register in IDEC PLC. The IDEC Modbus Mapping for this address is 401501. So in OPC ua I brought it in as a holding Register INT16

---

<div class="post-metadata">

**Author:** ![Lance\_Moore](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@Lance\_Moore](https://forum.inductiveautomation.com/u/Lance_Moore)\
**Post date:** [February 29, 2024, 7:18pm UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/7 "2024-02-29T19:18:27Z")

</div>

Message: Error sending complete subscription set to gateway.  
Time: Wed Feb 28 4:43:26PM  
Severity: ERROR  
Logger: tags.subscriptions  
Stack Trace: com.inductiveautomation.ignition.client.gateway\_interface.GatewayException: No route to host: no further information  
&nbsp;&nbsp;&nbsp;&nbsp;at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.newGatewayException(GatewayInterface.java:360)  
&nbsp;&nbsp;&nbsp;&nbsp;at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.getResponse(GatewayInterface.java:556)  
&nbsp;&nbsp;&nbsp;&nbsp;at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.sendMessage(GatewayInterface.java:292)  
&nbsp;&nbsp;&nbsp;&nbsp;at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.sendMessage(GatewayInterface.java:287)  
&nbsp;&nbsp;&nbsp;&nbsp;at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.invoke(GatewayInterface.java:967)  
&nbsp;&nbsp;&nbsp;&nbsp;at com.inductiveautomation.ignition.client.tags.impl.ClientTagSubscriptionManager.syncSubscriptions(ClientTagSubscriptionManager.java:358)  
&nbsp;&nbsp;&nbsp;&nbsp;at com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine$TrackedTask.run(BasicExecutionEngine.java:587)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/java.lang.Thread.run(Unknown Source)  
Caused by: java.net.NoRouteToHostException: No route to host: no further information  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/sun.nio.ch.Net.pollConnect(Native Method)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/sun.nio.ch.Net.pollConnectNow(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/sun.nio.ch.NioSocketImpl.connect(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/java.net.Socket.connect(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/sun.net.NetworkClient.doConnect(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/sun.net.www.http.HttpClient.openServer(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/sun.net.www.http.HttpClient.openServer(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/sun.net.www.http.HttpClient.\<init\>(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/sun.net.www.http.HttpClient.New(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/sun.net.www.http.HttpClient.New(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)  
&nbsp;&nbsp;&nbsp;&nbsp;at com.inductiveautomation.ignition.client.gateway\_interface.GatewayInterface.getResponse(GatewayInterface.java:423)  
&nbsp;&nbsp;&nbsp;&nbsp;... 11 common frames omitted

---

<div class="post-metadata">

**Author:** ![Lance\_Moore](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@Lance\_Moore](https://forum.inductiveautomation.com/u/Lance_Moore)\
**Post date:** [February 29, 2024, 7:20pm UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/8 "2024-02-29T19:20:48Z")

</div>

So if my plc doesn't support the bit option, are there any other ways to make this work?

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [February 29, 2024, 8:26pm UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/9 "2024-02-29T20:26:22Z")

</div>

> [@Lance\_Moore](#):
>
> No route to host: no further information

google this and you find

> Signals that an error occurred while attempting to connect a socket to a remote address and port. Typically, the remote host cannot be reached because of an intervening firewall, or if an intermediate router is down.

---

<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:** [February 29, 2024, 8:34pm UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/10 "2024-02-29T20:34:13Z")

</div>

I don't think the error you posted is related, so let's figure that out first. Can you upload your logs here (or somewhere)?

---

<div class="post-metadata">

**Author:** ![Lance\_Moore](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@Lance\_Moore](https://forum.inductiveautomation.com/u/Lance_Moore)\
**Post date:** [March 1, 2024, 4:19pm UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/11 "2024-03-01T16:19:41Z")

</div>

[Ignition-vultr-guest\_Ignition\_logs\_20240301-1618.idb](https://forum.inductiveautomation.com/uploads/short-url/2R721hirDn62lyzNDyjJoi8i4fX.idb) (4.7 MB)

---

<div class="post-metadata">

**Author:** ![Lance\_Moore](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@Lance\_Moore](https://forum.inductiveautomation.com/u/Lance_Moore)\
**Post date:** [March 1, 2024, 4:21pm UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/12 "2024-03-01T16:21:01Z")

</div>

I just posted the logs.

---

<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:** [March 1, 2024, 4:29pm UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/13 "2024-03-01T16:29:14Z")

</div>

Okay, so it does seem this device doesn't implement Mask Write Registers:

```auto
2024-02-28 15:45:18:193 drivers-modbusdriver2-BHD-1 Received response with ExceptionCode: 0x01 (IllegalFunction). unitId=1, referenceAddress=1499 
2024-02-28 15:51:21:055 drivers-modbusdriver2-BHD-2 Received response with ExceptionCode: 0x01 (IllegalFunction). unitId=1, referenceAddress=1500 

```

Unfortunately this means a bit of work to get around it... you have to assemble any bits you want to write into a whole word and then write that word to the register. You can create a Derived Tag for each bit to make things a little easier.

This approach is described here: [Troubles making a Derived Boolean Tag work as a mask for a Short Tag - #2 by Kevin.Herron](https://forum.inductiveautomation.com/t/troubles-making-a-derived-boolean-tag-work-as-a-mask-for-a-short-tag/15203/2)

---

<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:** [March 1, 2024, 4:42pm UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/14 "2024-03-01T16:42:10Z")

</div>

Or use the whole register for the operating mode, and write 0, 1, or 2 as appropriate. Avoids race conditions and is compatible with broken Modbus implementations.

---

<div class="post-metadata">

**Author:** ![Lance\_Moore](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@Lance\_Moore](https://forum.inductiveautomation.com/u/Lance_Moore)\
**Post date:** [March 1, 2024, 5:58pm UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/15 "2024-03-01T17:58:52Z")

</div>

Can you show an example of this approach ?

---

<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:** [March 1, 2024, 6:06pm UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/16 "2024-03-01T18:06:28Z")

</div>

Bind both `controlValue` and `indicatorValue` to your `D1500` tag. (`controlValue` must be a **bidirectional** binding, so it can write.) Provide your three options in the `states` property, in the order you want them shown. That's it, functionally. Everything else is just appearance.

---

<div class="post-metadata">

**Author:** ![Lance\_Moore](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@Lance\_Moore](https://forum.inductiveautomation.com/u/Lance_Moore)\
**Post date:** [March 2, 2024, 9:07am UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/17 "2024-03-02T09:07:42Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/2/f26b3dad8695fc83dc8e260ea83d6671686c9167.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/f/0faa15a2c3e696fcda5fe7fcca53799f003db09c.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/c/2c67bd9232a66386ad59877343ad17651eb937c8.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/e/ce69f2d91c7ab701f900fb4c1b36ac2c77212fae.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/7/67d270fe738847c27e12e7da7055ed9dcb332ca6.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/9/e9baceec33aef75adbf9d67f46b6f8158bcb83a4.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/6/86ba1c51c1e9ad773995f0cd729bb2e10e6b9cc8.png)  
Here is the error I'm getting now.

---

<div class="post-metadata">

**Author:** ![Lance\_Moore](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@Lance\_Moore](https://forum.inductiveautomation.com/u/Lance_Moore)\
**Post date:** [March 2, 2024, 9:12am UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/18 "2024-03-02T09:12:28Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/a/ca95ce6f39965b7023e77e74f1b9084795e52be9.png)

---

<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:** [March 2, 2024, 9:12am UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/19 "2024-03-02T09:12:34Z")

</div>

The error popup says there's a problem in line 2 of the multistateButton's onActionPerformed script. You'll need to post that here. Please post as formatted code. See [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831).

---

<div class="post-metadata">

**Author:** ![Lance\_Moore](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@Lance\_Moore](https://forum.inductiveautomation.com/u/Lance_Moore)\
**Post date:** [March 2, 2024, 9:17am UTC](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524/20 "2024-03-02T09:17:32Z")

</div>

how do i find the script on the multistate button?

[Next page](https://forum.inductiveautomation.com/t/multi-state-button-controlling-to-separate-boolean-tags/86524.md?page=2)
