cancelar
Mostrando los resultados de 
Buscar en lugar de 
Quiere decir: 

determining array index

In one of my VIs, I have an array of strings (login names) that feed a listbox.  The user is supposed to select one of the names in the list, then that name is used to do some other stuff.  Actually, the index of the name chosen is what I need.  I know how to get (from a Property Node) the Value of the selection, but I don't see a property that tells me what the index is of the selected item.  Does this property exist, or do I need to feed the string into a search routine?
0 kudos
Mensaje 1 de 8
3.353 Vistas
For a listbox the value of the terminal is the index.
0 kudos
Mensaje 2 de 8
3.352 Vistas
Sorry, it's a combo box.
0 kudos
Mensaje 3 de 8
3.344 Vistas
That's different.

A combobox's datatype is a string, so if you want the index you have to search the 1D array. Note that you do not need to use the "Value" property node. The terminal is the value.



You could also try a menu ring instead.


Message Edited by smercurio_fc on 07-02-2008 09:43 AM
0 kudos
Mensaje 4 de 8
3.342 Vistas
Just a heads up: if you are using the method smercurio_fc shows above, the index may not be correct if there are duplicate values in the combo box.  The index will always be the value of the first entry in the combo box.  I got caught on this a while back....
0 kudos
Mensaje 5 de 8
3.270 Vistas
Why would you have a combobox with duplicate values? Besides, a combobox doesn't allow you to have duplicate items.

EDIT: That is assuming that you're entering the items using the Properties dialog box. If you set the items programmatically, then you can have duplicate items. (Still don't know why you would want to do that. How is the user supposed to know which one to pick?)


Message Edited by smercurio_fc on 07-21-2008 01:59 PM
0 kudos
Mensaje 6 de 8
3.265 Vistas
Yes, I was populating programmatically from a db and this problem came up for me when my user loaded duplicate values into their database and so I had to change my code... 

I'm just posting this so that people are aware of the possibility.
0 kudos
Mensaje 7 de 8
3.254 Vistas
SELECT DISTINCT column name(s) FROM table_name ... Emoticono feliz
0 kudos
Mensaje 8 de 8
3.249 Vistas