# Dropdown list with more than 2 columns

**URL:** <https://forum.inductiveautomation.com/t/dropdown-list-with-more-than-2-columns/8888>\
**Category:** Ignition\
**Created:** [August 11, 2014, 3:28pm UTC](https://forum.inductiveautomation.com/t/dropdown-list-with-more-than-2-columns/8888 "2014-08-11T15:28:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![JGJohnson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jgjohnson/32/29582_2.png) [@JGJohnson](https://forum.inductiveautomation.com/u/JGJohnson)\
**Post date:** [August 11, 2014, 3:28pm UTC](https://forum.inductiveautomation.com/t/dropdown-list-with-more-than-2-columns/8888/1 "2014-08-11T15:28:15Z")

</div>

I have a situation where it would be very convenient to bring in a third column to the data set for an existing drop down list. I added the 3rd column to the bound query and I have no problem getting the value I need with the following script.

`if event.propertyName == "selectedIndex":
	ds = event.source.data
	user_name = ds.getValueAt(event.newValue, "username")`

The documentation that I’ve found never mentions using the control this way and specifically states that the control uses a 1 or 2 column data set.

Is anybody already doing this and if so have you had any problems using the control with a data set that has more than 2 columns?

---

<div class="post-metadata">

**Author:** ![Francisco.Mejia](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/francisco.mejia/32/63246_2.png) [@Francisco.Mejia](https://forum.inductiveautomation.com/u/Francisco.Mejia)\
**Post date:** [August 11, 2014, 4:26pm UTC](https://forum.inductiveautomation.com/t/dropdown-list-with-more-than-2-columns/8888/2 "2014-08-11T16:26:29Z")

</div>

Hi there,

What exactly do you want to do and what column do you want to select. You can view all the columns in your dataset by selecting ‘dropdown\_display’ property in your designer screen for the drop down.

Francisco

---

<div class="post-metadata">

**Author:** ![JGJohnson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jgjohnson/32/29582_2.png) [@JGJohnson](https://forum.inductiveautomation.com/u/JGJohnson)\
**Post date:** [August 11, 2014, 4:35pm UTC](https://forum.inductiveautomation.com/t/dropdown-list-with-more-than-2-columns/8888/3 "2014-08-11T16:35:11Z")

</div>

[quote=“Francisco.Mejia”]Hi there,

What exactly do you want to do and what column do you want to select. You can view all the columns in your dataset by selecting ‘dropdown\_display’ property in your designer screen for the drop down.

Francisco[/quote]

I want to use a 3rd column. I have it in place and it is working.

I was just wanting to hear if anyone else has done this and could tell me if it is a bad idea or not.

Something along the lines of either “Yes I’ve done the same thing and never had a problem” or “You could do that but here’s the problem with it.”

I suspect I will have no problems but I am using the control in a way that it was not intended to be used.

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [August 11, 2014, 4:53pm UTC](https://forum.inductiveautomation.com/t/dropdown-list-with-more-than-2-columns/8888/4 "2014-08-11T16:53:27Z")

</div>

Hi JGJohnson,

I have probably done this before. I really doubt there is any problem with it.

From my experience the components in Ignition are quite flexible and extensible and can be configured or scripted to be used in a lot of ways.

Many of the components in Ignition are based off of java swing components that were designed to be configured and used in many ways.

Ignition’s Dropdown List is derived directly from Java Swing’s JComboBox, which you can read about here: [docs.oracle.com/javase/tutorial/ … bobox.html](http://docs.oracle.com/javase/tutorial/uiswing/components/combobox.html)

Cheers,

---

<div class="post-metadata">

**Author:** ![Francisco.Mejia](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/francisco.mejia/32/63246_2.png) [@Francisco.Mejia](https://forum.inductiveautomation.com/u/Francisco.Mejia)\
**Post date:** [August 11, 2014, 4:58pm UTC](https://forum.inductiveautomation.com/t/dropdown-list-with-more-than-2-columns/8888/5 "2014-08-11T16:58:29Z")

</div>

There shouldn’t be any issue although looking at the sample script you are providing I would consider checking if the index is a valid index and if not what do you want to do.

Regards  
Francisco

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [August 11, 2014, 6:49pm UTC](https://forum.inductiveautomation.com/t/dropdown-list-with-more-than-2-columns/8888/6 "2014-08-11T18:49:00Z")

</div>

I took a quick scan through the code, and it looks like all we care about is the first one or two columns. I don’t see anything that would break if you have more than two columns – we just ignore the extras.

---

<div class="post-metadata">

**Author:** ![JGJohnson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jgjohnson/32/29582_2.png) [@JGJohnson](https://forum.inductiveautomation.com/u/JGJohnson)\
**Post date:** [August 11, 2014, 10:33pm UTC](https://forum.inductiveautomation.com/t/dropdown-list-with-more-than-2-columns/8888/7 "2014-08-11T22:33:10Z")

</div>

Thanks everybody for the feedback. ![:thumb_left:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e26afb081ddde6df016df6ee49159cf56aaca688.gif ":thumb\_left:")
