You can enter a single value or lists and ranges of values in the selector label of a Case structure, as shown in the following table.
Type of Values | Description of Type of Values | ||
---|---|---|---|
Numeric ranges |
|
||
String ranges | A range of a..c includes all strings beginning with a or b, but not c. String ranges are case sensitive. For example, a range of A..c behaves differently than a..c because LabVIEW uses ASCII values to determine a string range. | ||
Enumerated values | The values display in quotation marks, for example "red", "green", and "blue". However, you do not need to type the quotation marks when you enter the values unless the string or enumerated value contains a comma or range symbol ("," or ".."). In a string value, use special backslash codes for non-alphanumeric characters, such as \r for a carriage return, \n for a line feed, and \t for a tab. |
If you change the data type of the wire connected to the case selector of a Case structure, the Case structure automatically converts the selector label values to the new data type when possible. If you convert a numeric value, for example 19, to a string, the string value is “19”. If you convert a string to a numeric value, LabVIEW converts only those string values that represent a number. The other values remain strings. If you convert a number to a Boolean value, LabVIEW converts 0 to False and 1 to True, and all other numeric values become strings.
If you enter a selector label value that is not the same type as the object wired to the case selector, the value appears red. This indicates that the VI will not run until you delete or edit the value.
Note Because of the possible round-off error inherent in floating-point arithmetic, you cannot use floating-point numbers as selector label values. If you wire a floating-point value to the case selector, LabVIEW rounds the value to the nearest integer. If you type a floating-point value in the selector label, the value appears red to indicate that you must delete or edit the value before the structure can execute. You also cannot use fixed-point numbers as selector label values. If you wire a fixed-point number to the case selector, the VI appears with a broken Run button. |