Dropdown list with more than 2 columns

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?

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=“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.

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

Cheers,

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

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.

Thanks everybody for the feedback. :thumb_left: