# Connect multiple Boolean states to dropdown menu

**URL:** <https://forum.inductiveautomation.com/t/connect-multiple-boolean-states-to-dropdown-menu/70535>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [March 2, 2023, 3:33pm UTC](https://forum.inductiveautomation.com/t/connect-multiple-boolean-states-to-dropdown-menu/70535 "2023-03-02T15:33:36Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Eubanks](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@Michael\_Eubanks](https://forum.inductiveautomation.com/u/Michael_Eubanks)\
**Post date:** [March 2, 2023, 3:33pm UTC](https://forum.inductiveautomation.com/t/connect-multiple-boolean-states-to-dropdown-menu/70535/1 "2023-03-02T15:33:36Z")

</div>

Hello,

I have 3 OPC Boolean tags that I need to connect to the values of a dropdown menu on a screen. The user should select one option and it writes a True out to one, and a False out to the others.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [March 2, 2023, 4:26pm UTC](https://forum.inductiveautomation.com/t/connect-multiple-boolean-states-to-dropdown-menu/70535/2 "2023-03-02T16:26:34Z")

</div>

Use a `propertyChange` script to write to your three tags when the selected value changes. I would show the current state of those three booleans separately, and/or have an on-startup script that would set the value based on the current booleans.

---

<div class="post-metadata">

**Author:** ![Michael\_Eubanks](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@Michael\_Eubanks](https://forum.inductiveautomation.com/u/Michael_Eubanks)\
**Post date:** [March 2, 2023, 4:31pm UTC](https://forum.inductiveautomation.com/t/connect-multiple-boolean-states-to-dropdown-menu/70535/3 "2023-03-02T16:31:18Z")

</div>

I tried that, but whenever my cursor moved over it then it wrote a 1 out to the first of the values and kept me from selecting anything else.

I was able to get a memory tag to pull an integer value from the list, and I tried to get that to write out values, but nothing would allow me to actually write out a value on the tag.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [March 2, 2023, 4:32pm UTC](https://forum.inductiveautomation.com/t/connect-multiple-boolean-states-to-dropdown-menu/70535/4 "2023-03-02T16:32:44Z")

</div>

Can we see the script(s)? And vision or perspective?

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [March 2, 2023, 5:20pm UTC](https://forum.inductiveautomation.com/t/connect-multiple-boolean-states-to-dropdown-menu/70535/5 "2023-03-02T17:20:32Z")

</div>

I went ahead and tested this out on my own, using Perspective.

I combined the three booleans into a single "intermediate" memory expression tag "BoolINT":

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/d/1d1d286e63d27d41fd0b48d4e69f9ae2dae66852.png)

```auto
BoolINT = {[.]Bool1}*1+{[.]Bool2}*2+{[.]Bool3}*3

```

The dropdown's value is bound to `BoolINT` (not bidirectionally) and a `propertyChange` script is applied:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/a/1aa1a4f5f0b59fe1964679d4a251a4a96d784b64.png)

```auto
def valueChanged(self, previousValue, currentValue, origin, missedEvents):
	if currentValue.value == 1:
		values = [True,False,False]
	elif currentValue.value == 2:
		values = [False,True,False]
	elif currentValue.value == 3:
		values = [False,False,True]
		
	system.tag.writeBlocking(["[default]Test/Bool1","[default]Test/Bool2","[default]Test/Bool3"], values)

```

The same idea would apply in Vision, just applied slightly differently.

---

<div class="post-metadata">

**Author:** ![Travis\_Leanna](https://avatars.discourse-cdn.com/v4/letter/t/dec6dc/32.png) [@Travis\_Leanna](https://forum.inductiveautomation.com/u/Travis_Leanna)\
**Post date:** [April 6, 2023, 2:03pm UTC](https://forum.inductiveautomation.com/t/connect-multiple-boolean-states-to-dropdown-menu/70535/6 "2023-04-06T14:03:01Z")

</div>

I have this same question, but for Vision. I have tried to copy your script and expression tag, inserting my tags instead of yours, but I cannot get it to work. I get an Error\_Configuration in the tag and Quality of the component. This is my first Ignition project, so much of this is new to me. Much appreciation for any help.

 ![Screenshot 2023-04-06 084846](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/c/ec43420e0b2012344ff67bcc7931a0d4f6388cd4.png)  
 ![Screenshot 2023-04-06 084741](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/e/0e6e379070bf3d286eddcd0f4d8222a08b4670cc.png)  
 ![Screenshot 2023-04-06 084641](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/8/f81e053c40bd48badd021f73a5e40e2bee27cf56.png)

---

<div class="post-metadata">

**Author:** ![grietveld](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/grietveld/32/6984_2.png) [@grietveld](https://forum.inductiveautomation.com/u/grietveld)\
**Post date:** [April 6, 2023, 2:44pm UTC](https://forum.inductiveautomation.com/t/connect-multiple-boolean-states-to-dropdown-menu/70535/7 "2023-04-06T14:44:15Z")

</div>

Looks like you are missing a quote in your writeBlocking line in the script on the last tag.

For your expression, you can remove the 'systemOperationModeSelector =' as well. I don't think that would be a valid expression which is probably why you are getting the Error\_Configuration.

---

<div class="post-metadata">

**Author:** ![Travis\_Leanna](https://avatars.discourse-cdn.com/v4/letter/t/dec6dc/32.png) [@Travis\_Leanna](https://forum.inductiveautomation.com/u/Travis_Leanna)\
**Post date:** [April 6, 2023, 3:00pm UTC](https://forum.inductiveautomation.com/t/connect-multiple-boolean-states-to-dropdown-menu/70535/8 "2023-04-06T15:00:43Z")

</div>

thank you, yes, i had already found the missing quote. I also changed the 'systemOperationModeSelector' to the actual tag. should i just remove it completely?

---

<div class="post-metadata">

**Author:** ![grietveld](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/grietveld/32/6984_2.png) [@grietveld](https://forum.inductiveautomation.com/u/grietveld)\
**Post date:** [April 6, 2023, 3:15pm UTC](https://forum.inductiveautomation.com/t/connect-multiple-boolean-states-to-dropdown-menu/70535/9 "2023-04-06T15:15:48Z")

</div>

Correct, if you do an equals typically in an expression it just turns into a boolean comparison and not assigning the value on the right side of the equation. Assuming you want the tag to have the value of what you are evaluating on the right, you will just leave that portion as the Expression.

This section of the manual is useful when starting out with Expressions to know syntax and some of the different options you have.

[https://docs.inductiveautomation.com/display/DOC81/Expression+Language+and+Syntax](https://docs.inductiveautomation.com/display/DOC81/Expression+Language+and+Syntax)

---

<div class="post-metadata">

**Author:** ![Travis\_Leanna](https://avatars.discourse-cdn.com/v4/letter/t/dec6dc/32.png) [@Travis\_Leanna](https://forum.inductiveautomation.com/u/Travis_Leanna)\
**Post date:** [April 6, 2023, 3:19pm UTC](https://forum.inductiveautomation.com/t/connect-multiple-boolean-states-to-dropdown-menu/70535/10 "2023-04-06T15:19:41Z")

</div>

Thank you so much!
