Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
7 rating:
 1.85 out of 5   

How Do I Specify a List or Range of String Values for a Certain Case in a Case Structure?

Primary Software: LabVIEW Development Systems
Primary Software Version: N/A
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem: I have a String Case Structure and I want to select from a list of String values, several of which are COM ports (e.g, COM1 through COM6). Can I have a single case in the Case Structure that represents any of the COM ports that I want to select?


String Case Structures are similar to Numeric Case Structures when specifying a list or range of values in the Case Selector (i.e., the rectangular box at the top of the Case Structure). To specify a list, you must separate the values by commas. For example, if you had a list of animals and you wanted the words "dog" and "cat" to refer to the same case in the Case Structure, then you would enter those values like this in the Case Selector:

"dog", "cat"

To specify a range of values, you must separate the values by two periods (..). Unlike other Case Structures, String Case Structures exclude the upper range value, so to include the upper value in the range, you must add the upper value to your list. For example, to have a single case in the Case Structure accept multiple COM ports, you would specify the range of COM ports like this:

"COM1".."COM6", "COM6"

(A range of string values works alphabetically.) Remember that the String values are case sensitive, so to make the Case Structure more flexible, you could use a list of ranges like this:

"com1".."com6", "com6", "COM1".."COM6", "COM6"

Note: LabVIEW 6.0 (and higher) has an option for Case Structures to do a "Case Insensitive Match" (pop-up on the Case Structure and select this option from the pop-up menu), so you would only need to use "COM1".."COM6", "COM6" as in the first example.

In LabVIEW 7.1 or earlier, refer to chapter 8 of the LabVIEW User Manual (linked below) for more information about case structures. In LabVIEW 8.0 or later, refer to the Case and Sequence Structures topic in the LabVIEW Help (linked below).

Related Links:
Product Manuals: LabVIEW User Manual
LabVIEW Help: Case and Sequence Structures


Report Date: 05/10/2001
Last Updated: 09/19/2007
Document ID: 299BTMJ3

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit