LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I generate a list of enumerations of possible cases?

Hi there,

I appologize if this question is answered in the boards but I did look and was not able to find anything that helped me.  

 

I have a case structure that runs a specific test when that test is called in a text file.  The case structure is burried in some other states.  I do not to use the text file anymore, but want to display a selectable array of possible tests (that start with the word "Test") and have the user select the test from this list (which would be a list of cases that are updated when I update the case structure later).

 

I am not sure how to pull the possible case values out of the case structure.   Is this possible?

Thank you!
Crystal

0 Kudos
Message 1 of 5
(3,309 Views)

I don't think you can pull out the list of cases from a case structure.  Do you have access to the file that contains the test names?  This would be your best bet.  Is the case based on strings or an enum?  If enum, you can get the item names with a property node.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 5
(3,292 Views)
Well, actually you can pull out the case items. You just need the scipting API to do it. Don't have something available right now to whip up an example, though. Will try tomorrow.
0 Kudos
Message 3 of 5
(3,279 Views)
I'm not 100% sure what you mean, but in order to neatly connect a case structure to choices you'll use a Enum (preferrably a type-def'd one).
If so, you can use the Strings[] property to get the possible choices. A Enum control is also the Selectable list you're asking for. You cant update it by updating the Case structure, but you can go the other way around! If you update the Enum you can r-click the case structure and select "Add case for every value", and if you dont use "default" on any choice you'll get a broken wire if you haven't, which is a good regulator.

If a Enum doesn't solve your problem and you need higher run time versatility you can use Ring controls, although there's no automagic when connecting cases to those.

/Y
G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 5
(3,261 Views)