10-06-2015 10:52 AM
Hi,
I'm working on a project where I need to be able to select a protocol --> get that protocol from an excel file and read out the protocol from excel so I can use it.
It also has to be easy to add a protocol.
I was thinking of using a menu ring or combo box, but I havn't really worked with that, so I have no idea where to start and how to work it out.
Could you maybe help me to get started with this?
I hope I described everything correct, if you have more questions, please let me know!
Thank you!
10-06-2015 10:55 AM - edited 10-06-2015 10:57 AM
Have you tried anything yet? DO you have a program that you are adding this on to? How will this section of code be triggered to run (dialog, value change event, etc)?
The approach to something like this is to break it in to separate components:
You should test these separate components alone to make sure they function (mainly the excel part probably) and then put them together.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
10-07-2015 04:31 AM
Thank you for your reply.
It is part of a bigger program, where the protocol will be read from a 2d array.
I want the program to start, then be able to select to protocol, and then run the rest of the program.
The attached file is what I have so far.
10-07-2015 10:42 AM
@Ruben29 wrote:
I'm working on a project where I need to be able to select a protocol --> get that protocol from an excel file and read out the protocol from excel so I can use it.
It also has to be easy to add a protocol.
If the list of protocols was fixed and known, I would advocate using an Enum. But if it is important to add protocols at run-time, then you need something like a ring that you can modify.
You might think about the design a bit, though. It seems to me that there are two related-but-different tasks here. One is running your program, which consists of "Run Protocol X". The other is running a "meta"-routine to manage the list of Protocols. To me, these are slightly different, and I might want a separate control for "Protocol Maintenance" vs "Protocol Execution".
The other thing is you mention using an Excel file, and your sample code shows a file with the .xlsx extension. Note that .xlsx files are not "Text" files, hence should probably not be used with the LabVIEW "Spreadsheet" (now better named "Delimited Spreadsheet") functions. The Report Generation Toolkit, however, dies a fine job reading from and writing to true Excel files (you need Excel installed, of course).
Bob Schor
10-07-2015 10:59 AM
Hello,
I am Vasileios from National Instruments Technical Support. I am happy to help you with your issue.
As James said some good steps to begin with are to:
- choose the LabVIEW architecture you want to use and
- make sure you can write and read an excel file according your purposes.
Have you thought of writing another VI, which purpose will be only to write the protocols into either a text file or a control inside LabVIEW lets say through an array or a cluster?
Furthermore, you can use a Flat Sequence Structure to make sure when you run your VI, the user will select the protocol first thing.
I hope this information is helpful and you are successful at your application.
Kind regards,
Vasileios