Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.* 2 > Newsgroup comp.lang.labview

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 07-02-2008, 02:10 PM
mrbean
Guest
 
Posts: n/a
Default 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?
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 07-02-2008, 02:10 PM
smercurio_fc
Guest
 
Posts: n/a
Default Re: determining array index

For a listbox the value of the terminal is the index.
Reply With Quote
  #3 (permalink)  
Old 07-02-2008, 02:40 PM
mrbean
Guest
 
Posts: n/a
Default Re: determining array index

Sorry, it's a combo box.
Reply With Quote
  #4 (permalink)  
Old 07-02-2008, 03:10 PM
smercurio_fc
Guest
 
Posts: n/a
Default Re: determining array index

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.<img src="http://forums.ni.com/attachments/ni/170/337012/1/Example_VI_BD6.png"> You could also try a menu ring instead. Message Edited by smercurio_fc on 07-02-2008 09:43 AM


Example_VI_BD6.png:
http://forums.ni.com/attachments/ni/...ple_VI_BD6.png
Reply With Quote
  #5 (permalink)  
Old 07-21-2008, 07:10 PM
bkling
Guest
 
Posts: n/a
Default Re: determining array index

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.&nbsp; The index will always be the value of the first entry in the combo box.&nbsp; I got caught on this a while back....
Reply With Quote
  #6 (permalink)  
Old 07-21-2008, 07:10 PM
smercurio_fc
Guest
 
Posts: n/a
Default Re: determining array index

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
Reply With Quote
  #7 (permalink)  
Old 07-21-2008, 07:40 PM
bkling
Guest
 
Posts: n/a
Default Re: determining array index

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...&nbsp; I'm just posting this so that people are aware of the possibility.
Reply With Quote
  #8 (permalink)  
Old 07-21-2008, 07:40 PM
smercurio_fc
Guest
 
Posts: n/a
Default Re: determining array index

SELECT DISTINCT column name(s) FROM table_name ... :smileyhappy:
Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: weird problem with array name Arthur Tabachneck Newsgroup comp.soft-sys.sas 0 11-07-2008 02:32 PM
Re: MAX of _TEMPORARY_ array? Venky Chakravarthy Newsgroup comp.soft-sys.sas 0 06-27-2005 09:19 PM
Re: MAX of _TEMPORARY_ array? nospam@HOWLES.COM (Howard Schreier Newsgroup comp.soft-sys.sas 0 06-27-2005 04:51 PM
Re: find max value and index in an array Harry Droogendyk Newsgroup comp.soft-sys.sas 0 04-27-2005 02:54 AM



All times are GMT. The time now is 03:07 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.