LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Selecting different cases from drop down in front panel

Solved!
Go to solution

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

 

selectcasefromfp.PNG

0 Kudos
Message 1 of 16
(4,993 Views)

@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?


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 2 of 16
(4,986 Views)

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?

0 Kudos
Message 3 of 16
(4,980 Views)

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

0 Kudos
Message 4 of 16
(4,960 Views)

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.

Message 5 of 16
(4,956 Views)

Youre using a ring control - use an enum. (If youre going to use it in more than one place, make it a typedef.)

0 Kudos
Message 6 of 16
(4,945 Views)

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

0 Kudos
Message 7 of 16
(4,943 Views)
Solution
Accepted by LabNoob14

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. 

Message 8 of 16
(4,936 Views)

@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.


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 9 of 16
(4,931 Views)

@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?

0 Kudos
Message 10 of 16
(4,925 Views)