# How can I default Dropdown selection to first item in list?

**URL:** <https://forum.inductiveautomation.com/t/how-can-i-default-dropdown-selection-to-first-item-in-list/5203>\
**Category:** Ignition\
**Created:** [September 26, 2012, 8:47pm UTC](https://forum.inductiveautomation.com/t/how-can-i-default-dropdown-selection-to-first-item-in-list/5203 "2012-09-26T20:47:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bob/32/16899_2.png) [@Bob](https://forum.inductiveautomation.com/u/Bob)\
**Post date:** [September 26, 2012, 8:47pm UTC](https://forum.inductiveautomation.com/t/how-can-i-default-dropdown-selection-to-first-item-in-list/5203/1 "2012-09-26T20:47:00Z")

</div>

I am populating the data of the dropdown using a SQL Query (which returns only one column) and I want to default the Dropdown selection to first item in the returned recordset. I also want to have the selection label be set to this value. How can I do this?

By default the dropdown defaults to and I have to select the first item.

I imagine this is easy, but for some reason I have been struggling with many different options tried.

Thanks,  
Bob

---

<div class="post-metadata">

**Author:** ![Michael.Stofan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.stofan/32/3342_2.png) [@Michael.Stofan](https://forum.inductiveautomation.com/u/Michael.Stofan)\
**Post date:** [September 26, 2012, 9:35pm UTC](https://forum.inductiveautomation.com/t/how-can-i-default-dropdown-selection-to-first-item-in-list/5203/2 "2012-09-26T21:35:48Z")

</div>

Try saving the window with the ‘selected value’ property set to ‘0’ instead of ‘-1’. Also, make sure you have your SQL query binding set to not poll.

---

<div class="post-metadata">

**Author:** ![Bob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bob/32/16899_2.png) [@Bob](https://forum.inductiveautomation.com/u/Bob)\
**Post date:** [September 27, 2012, 5:41pm UTC](https://forum.inductiveautomation.com/t/how-can-i-default-dropdown-selection-to-first-item-in-list/5203/3 "2012-09-27T17:41:23Z")

</div>

I tried your suggestion but the behavior did not change.

I found that adding the following line to the propertyChange event of the Dropdown did the trick:

```
      event.source.parent.getComponent('Dropdown 1').selectedValue = 0
```

---

<div class="post-metadata">

**Author:** ![Michael.Stofan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.stofan/32/3342_2.png) [@Michael.Stofan](https://forum.inductiveautomation.com/u/Michael.Stofan)\
**Post date:** [September 27, 2012, 5:59pm UTC](https://forum.inductiveautomation.com/t/how-can-i-default-dropdown-selection-to-first-item-in-list/5203/4 "2012-09-27T17:59:45Z")

</div>

I’m glad you found a solution! Just out of curiosity, what version of Ignition are you using?

---

<div class="post-metadata">

**Author:** ![Bob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bob/32/16899_2.png) [@Bob](https://forum.inductiveautomation.com/u/Bob)\
**Post date:** [September 27, 2012, 6:52pm UTC](https://forum.inductiveautomation.com/t/how-can-i-default-dropdown-selection-to-first-item-in-list/5203/5 "2012-09-27T18:52:59Z")

</div>

7.5.1
