# Better way to allow no selection in dropdowns?

**URL:** <https://forum.inductiveautomation.com/t/better-way-to-allow-no-selection-in-dropdowns/36247>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [July 1, 2020, 1:51pm UTC](https://forum.inductiveautomation.com/t/better-way-to-allow-no-selection-in-dropdowns/36247 "2020-07-01T13:51:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [July 1, 2020, 1:51pm UTC](https://forum.inductiveautomation.com/t/better-way-to-allow-no-selection-in-dropdowns/36247/1 "2020-07-01T13:51:47Z")

</div>

In my project, when we use dropdowns, in the Data property our SQL query is usually a union query -

```auto
(SELECT -1 as 'Value', 'Select One' as 'Label')
UNION
(SELECT real data here)

```

This makes ordering the dropdowns a little annoying too because I need to make the ‘Select one’ the first row using an exception, etc. Is there a way to make it so the dropdown always shows a None-Select option without using this data method? Otherwise, currently, when you select a dropdown, its impossible to revert to no selection - ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/e/9e91788c741d5a5ff26909bb50e5add85cf4b83b.png)

---

<div class="post-metadata">

**Author:** ![danieltalbot](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/danieltalbot/32/11201_2.png) [@danieltalbot](https://forum.inductiveautomation.com/u/danieltalbot)\
**Post date:** [July 1, 2020, 3:08pm UTC](https://forum.inductiveautomation.com/t/better-way-to-allow-no-selection-in-dropdowns/36247/2 "2020-07-01T15:08:05Z")

</div>

If you just want the ability to reset a dropdown to -1 so that it says ‘Select One’

You could set a button next to the dropdown, bind the visible property to the dropdown selectedValue != -1, and then give it a script that sets the dropdown selectedValue to -1.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/a/ca597d360d13a0c85cb95fd4f15505c512b9c74c.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/d/3d1cb401dbbbf0b77320cc4904c8fa101148b609.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/d/0dc228d9fbff29cfe7901471997533fe4109e038.png)

---

<div class="post-metadata">

**Author:** ![craigb](https://avatars.discourse-cdn.com/v4/letter/c/9f8e36/32.png) [@craigb](https://forum.inductiveautomation.com/u/craigb)\
**Post date:** [July 3, 2020, 3:04pm UTC](https://forum.inductiveautomation.com/t/better-way-to-allow-no-selection-in-dropdowns/36247/3 "2020-07-03T15:04:08Z")

</div>

This is how I do it in a named query

```auto
Select 'ALL' As value, 'All Serials' as label
Union All
SELECT serial AS id, serial
FROM equipment
ORDER BY label

```

All serials is basically no selection. In the designer I have ALL as the set value so it always defaults to no selection when opening the view.

I played around in changing the text all serials to select one and that droppped it down in the list due to sorting alphabetically. But when I put it in angle brackets it put it back to the top of the list.

So the final code is…

```auto
Select 'ALL' As value, '<Select One>' as label
Union All
SELECT serial AS id, serial
FROM equipment
ORDER BY label

```

To get more complex i have various values filtering the table, so in the drop down I have a custom property.

```auto
if ({this.props.value}='ALL',
	"serial >= ''",
	concat("serial = '",{this.props.value},"'")
	)

```

This basically ignores the drop down value if its ‘All’ or uses the value to filter the table if something else is selected.

Then use that custom property as query strings in a named query…

```auto
SELECT serial AS Serial, catagory As Catagory, location AS Location
FROM equipment
WHERE {Serial}
AND {Catagory}
AND {Location}
Order by serial ASC

```

![Drop Down 1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/2/52162f35d05b6ecfc40e5922c4c905076a6bed04.jpeg) ![Drop Down](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/c/2cd8e46a57e9cff52827a3b13a3832c730eb98fb.jpeg)
