LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Drop down menu options from an excel file

Solved!
Go to solution

Hi,

 

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.

 

Regards,

DPac

0 Kudos
Message 1 of 10
(3,185 Views)

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.

0 Kudos
Message 2 of 10
(3,184 Views)

@smercurio_fc wrote:

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.

 

0 Kudos
Message 3 of 10
(3,173 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 10
(3,170 Views)

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.

 

Regards,

DPac

0 Kudos
Message 5 of 10
(3,164 Views)
Solution
Accepted by topic author DPac

Use the property Strings[].  You may have to right-click on the property and to set it to Write.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 10
(3,158 Views)

I like to use a configuration file for this. It requires a bit more manipulation but it allow to keep everything in the same file.

 

Ben64

 

populate ring_BD.png

Message 7 of 10
(3,148 Views)

[Edit - deleted 'cuz it missed the point]

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 8 of 10
(3,139 Views)

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.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
Message 9 of 10
(3,132 Views)

Thanks for all your suggestions guys! I appreciate it.

 

Cheers,

DPac

0 Kudos
Message 10 of 10
(3,116 Views)