LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Case Structure: No case for some selector values" Error

Solved!
Go to solution

Hello All,

 

I am new to LabVIEW and am getting an error that I cannot get rid of. My code consists of a state machine with 5 different states. I am not sure if this is a common error or if I need to supply more information. Please let me know and please help.

 

Best regards,

L.E.

0 Kudos
Message 1 of 7
(13,996 Views)

L.E.

If your state machine is a type def enum make sure you have a case for every value.  If your case selector is a number make sure all ranges are covered, or specify a 'default' case.

e.g.

Case:   0..10,15

Case:   12

Case:   Default

 

Post your code if you need more help 😉

Michael

0 Kudos
Message 2 of 7
(13,993 Views)
Solution
Accepted by L.E.

This is explained in the LabVIEW Help: http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/specify_default_case/

 

You are driving the case structure from an enum. If you connect an enum you need to provide a case for each enum value, or specify one case as the default case to execute if no case matches the value of the enum.

 

-Or-

 

You are driving the case structure from a string or numeric and do not have a case specified as the default case if no case matches the value of the string/numeric.

0 Kudos
Message 3 of 7
(13,991 Views)

What did you wire into the Case Selector?  You need to account for every possible value in the Cases (the thing at the top).  For Booleans, it's simple, as they are True and False, given to you by LabVIEW.  If you wire a numeric, however, you need to somehow specify all 256 or 65536 or an even bigger number of cases.  Fortunately, you can use "Default" as a case, meaning "Whatever I didn't mention in the other cases".  Try adding an additional case and naming it "Default" -- does this fix your problem?  [Note if you really want to only handle, say, 0, 1, 2, and 3, you can make 0 or one of the other cases the Default case, but better would be to have a separate Default and know if you get there, you have a "wrong" selector, one that is not 0 .. 3].

0 Kudos
Message 4 of 7
(13,990 Views)

OP will be overwhelmed by so much help so quickly! Smiley Very Happy

0 Kudos
Message 5 of 7
(13,985 Views)

River Daddy,

 

Thank you for all the help. I no longer have a broken arrow and for that, I am excited. Now I get to see if my code actually works.

 

Regards,

L.E.

0 Kudos
Message 6 of 7
(13,954 Views)

very helpful ,TANKEYOU

0 Kudos
Message 7 of 7
(13,894 Views)