04-12-2017 06:15 AM
Errors:
Case Structure: Selector values have wrong type
Case Structure: No case for some selector values
I'm getting these errors when I changed the name of the case structure from "True" to user-defined.
Any help is appreciated. Thanks
04-12-2017 06:33 AM - edited 04-12-2017 06:35 AM
Hi Ganny,
I'm getting these errors when I changed the name of the case structure from "True" to user-defined. Any help is appreciated.
Easy solution: revert from your "user-defined" case label and write "True" again… 😄
Better solution: replace the "case selector" boolean by an Enum control with two items. Wire this item to the case selctor input…
Other things:
- Mr. Fahrenheit has one more h in its name! 😉
- NOT(x XOR FALSE) is the same as a simple NOT(x)
- you even don't need the NOT when you just change the colors of the LED indicator…
- using AutoCleanup from time to time would be nice…
04-12-2017 06:37 AM
Your case structure's selector (if that's what the green question mark is called) is wired to a boolean control. Booleans only have the values true or false, so those are the cases that must be handled.
If you want to use a string control, you can do that instead - then Fahrenheit and Celsius will work. However, in that case, you'll need to specify one of the cases as default, because it's impossible to specify every possible value of a string.
Alternatively, you might want to consider an enum. These are controls which take a numeric value from a specified list. Since you can list every possible value, you don't have to give a default (by default! You can change the options to make this not true...) but the case structure displays the string value of the enum, which is also part of the type.
A radio button might also work for you - these are a graphical wrapper around enums.
04-12-2017 06:38 AM
You don't get to define the Language! Case statements are common in many computer systems, and they all have the same general form. There is a "Case Selector", meaning something that can take on a finite (and usually limited) set of values, then code to handle what happens for each possible value of the Selector.
In your case, the Selector is a Boolean, "Case Selector", which can take on only two values, Boolean True and Boolean False (I write "Boolean" because the values must be the same Type as the Selector). It makes no sense to say "Is Case Selector, which can only be Boolean "True", equal to the string "Fahrenheit". LabVIEW has generated some Error Messages that say exactly this (but without the longer explanation I've given).
Read the Help for the Case Structure. Learn LabVIEW. Spend time with the "Getting Started with LabVIEW" material on the first page of the LabVIEW Forums.
Bob Schor
04-12-2017 06:43 AM
Hey GerdW,
Thanks for the reply.
Where can I find Enum control? What is AutoCleanup and where do I find it?
04-12-2017 06:45 AM - edited 04-12-2017 06:53 AM
04-12-2017 06:48 AM
Thanks. I'll work it out.
04-12-2017 06:55 AM
I'm not able to find "Ring and Enum" Palette. Where exactly can I find it?
Thanks
04-12-2017 06:57 AM
I found it.
04-12-2017 06:58 AM