LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

A Problem of Case structure

Hi:
    I have 2 reading from a subVI, one is String and one is numerical. I try to connect the String reading (for example String1, String2, String3) to case selector but the case structure won't show the name and even I click "Add case after" it show nothing.
 
    But if I connect numerical reading to case. It will show all the number I readout and I click "add case after" it will automatic add the subsequent reading I read. 
 
   Is it anyone can help to solve this? Thank
Download All
0 Kudos
Message 1 of 3
(2,694 Views)
A string can have any value. LabVIEW cannot know what strings to expect at a case structure. So you have to type in the string you want in the title bar of the case structure. Also, with strings you need a default case to handle all strings that you didn't specify in other cases.
If you use integers, LabVIEW will create two cases to start with. You can edit the cases, for example you can create a case that handles the values 10..20. You'll still need a default case.
In one of your screenshots, you uses an enum. If you have kind of a state machine structure in your code, I recommend using enums (with type defs). Case structures know what cases to expect as the enums have fixed entries. With enums you don't need a default case (if you handle all enum values).
0 Kudos
Message 2 of 3
(2,680 Views)
Thank dan_u.
0 Kudos
Message 3 of 3
(2,650 Views)