07-31-2018 11:57 AM
I've been digging around and I haven't found anything that could answer my question which seems like a simple one.
All I want to do is be able to select different cases from the front panel in a nice clean drop down menu. What tool do we use to select cases from front panel?
Is the FOR loop needed, if so how should I set the loop count for 4 different cases?
Thanks
Solved! Go to Solution.
07-31-2018 12:18 PM
@LabNoob14 wrote:
Is the FOR loop needed, if so how should I set the loop count for 4 different cases?
If you only allow 1 selection, why do you need a FOR loop? The user selects the 1 item, so just read the 1 file. Or am I missing something?
07-31-2018 12:25 PM
You could autoindexing on an array of enums to decide what to do on each iteration.
Still, all this seems a bit convoluted. Can you describe in more general terms what you are trying to do?
07-31-2018 12:57 PM
I'm trying to pull spreadsheets (that have not all been created yet) 4 different ones for now.
I want to be able to control which spread sheet(file path) is being pulled, controlled from a drop down menu in the front panel. One at a time so maybe I don't need a FOR loop
I figured a case selector would be the most simple way to achieve that
07-31-2018 01:08 PM
Your filenames seem to be hardcoded (bad idea in general), but all you need is a diagram constant containing an array of paths and you would then use "index array" to pick one based on the enum wired to the index input. Check if it exists and act accordingly.
07-31-2018 01:41 PM
Youre using a ring control - use an enum. (If youre going to use it in more than one place, make it a typedef.)
07-31-2018 01:43 PM
So I could use a string array with a drop down type of menu? I wanted to use "Ring" but is that only for numerics?
I remember why I wanted to use a case structure though. At the same time a user selects a different type of test it would clear the shift reg values that's holding the BG colors.
Essentially I want to reset the front panel back to all BG colors green when a different test is selected. This should all be accomplished while the VI is running.
I just thought of something, if the shift reg is cleared will it reset all the data in the in the table? Because that would be bad. Sorry for getting off topic a bit
07-31-2018 01:50 PM
If you wire a Ring Control to a case structure, the case options will be numbers. I assume the problem you are trying to solve is that you would like to have the case structure options be the same as the values the user sees on the front panel - to do this, use an Enum instead. Right click on the enum and select Edit Items, then add the items you will want in your case structure.
Your VI will not do what you want as it is written - the case structure will read then the program will just run the secondary loop.
Spend some time looking at LabVIEW basics, and maybe look at a producer consumer template as a new starting point.
07-31-2018 01:55 PM
@LabNoob14 wrote:
So I could use a string array with a drop down type of menu? I wanted to use "Ring" but is that only for numerics?
If you want a Ring behavior but with a string data type, but a ComboBox.
07-31-2018 02:31 PM
@paul ross
Ah ok, I was naming the different cases in the case structure and trying to wire that up to Enum, doesn't work that way. I got it now, thanks.
All I would need to do is move the case structure and associated code into the WHILE loop right?