LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

property node for case structure

Is there any way to programatically pull out the list of cases (strings) from a case structure at run time?
0 Kudos
Message 1 of 4
(3,103 Views)
As far as I know, there are no usable properties for case structures.  One way to achieve your task is to create an enum with a list of all the cases, and use this to feed the case structure.  You can then get a list of all the items in the enum.
- tbob

Inventor of the WORM Global
Message 2 of 4
(3,093 Views)
There is a Selector Strings property, but you will have to use scripting to get it, which can be dangerous. Go to the LAVA forums' scripting board for more details (I think you have to be a member to see it).
 
If you only want to be able to display the strings to the user, you should use an enum control, as suggested by tbob. If you want to use in more than one place, make it a typedef and it will update all the instances automatically.

___________________
Try to take over the world!
Message 3 of 4
(3,076 Views)

Thank you tbob and tst.  I do use the enum "trick" in other places (I once saw it used in an example somewhere) and I am nervous about the Selector Strings property available through scripting after reading about it on the LAVA forums site (I am a novice LabView user and I mostly didn't know what they were talking about).

I have a VI that processes "tags" embedded in various text fields that many of my collegues use.  As an example we have a custom front end to the LabView simple error handler that processes our custom error codes and handles timed popups, writing to the device error log, etc.  The default behavior can be modified by inserting tags (<popup 60> for a dialog box with a 60 second timeout or <no device log> to supress writing an entry to our device error log) into the "source" string of a standard error cluster -- just like the <append> tag used by the Simple Error Handler.

In most instances there are only a few tags so I just use a case structure in the "tag processing VI" to select the desired action indicated by each tag.  When people are parsing their strings for tags, they like to have a qick and easy way to test if a string is a vaild tag.  I provide a separate "validator VI" to do this.  I frequently add and remove tags from the case structure as things evolve, but I often forget to update the list of valid tags used by the validator VI or some one runs into an older version on another machine.  I wanted to have the vaildator VI access the case structure on the tag processing VI to get the current list of vaild tags.

0 Kudos
Message 4 of 4
(3,055 Views)