08-29-2012 08:45 AM
I'm developing a test bench software. I need the end user to be able to choose a drop down menu (Enum probably) a specific test condition (or test parameters maybe). But the options in the menu need to be read from an Excel file, so that when a new option is available, it's name is added into the excel file and it appears in the drop down menu.
A simple picture of what I need has been attached. I would appreciate any help, suggestion or solution in this regard. Please excuse me if I have overlooked anything, I am a fairly new user to LabVIEW.
Solved! Go to Solution.
08-29-2012 08:49 AM
Reading from an Excel file is a question that has been asked hundreds of times. Did you try a search? Examples have even been posted.
Once you read the value all you need to do is to populate a menu ring. You cannot use an enum since an enum's value cannot be changed at run-time.
08-29-2012 09:15 AM
Reading from an Excel file is a question that has been asked hundreds of times.
In addition for something as simple as the OP has indicated, a text file is more than adequate.
08-29-2012 09:20 AM - edited 08-29-2012 09:23 AM
I would use a simple text file. Have each line be an allowed value. You can configure the Read Text File to read by lines (right click option) and wire the count to be -1 (read all lines) and you have your list. Furthermore, you can still open up the text file in Excel and edit it that way if you so desire.
I should also add that you will need to use a Ring, not an Enum since you are dynamically editing the items.
08-29-2012 09:27 AM
Sorry people, I think my question was a bit vague. I know how to read from a text/excel file. The problem is how do I send that across into a drop down menu? The VIs 'Menu & Ring', 'Ring', 'Enum' etc all have output points, but no inputs. That was my question. Once you have what you need as a string array, how do you show those as options in a drop down menu? I'm not very familiar with the 'Property node' and 'Invoke node' options, that's why the question.
08-29-2012 09:37 AM - edited 08-29-2012 09:38 AM
Use the property Strings. You may have to right-click on the property and to set it to Write.
08-29-2012 09:54 AM
08-29-2012 11:52 AM - edited 08-29-2012 11:53 AM
08-29-2012 12:12 PM
I'm with Ben64. Use a config file and the config file VIs to control the read/write of the file. As Crossrulz has already stated, use the property node to update the list. You would do this during initialization when the application first starts (i.e. read the config file, populate the ring control). You may also choose to have the ability to refresh your list during run, that's up to you. Do you plan on adding items manually to the file or through the application? Either way will work, but I would limit the access of the operator to your configuration file. You could enable such a feature based on login information.
08-30-2012 03:54 AM
Thanks for all your suggestions guys! I appreciate it.