LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case structure with string selector "N\A"

I have a case structure which is configured with a String selector.  When I try to add the case "N\A" LabVIEW changes it to "N\n".  I tried adding "N\a" and LabVIEW replaces it with "Na".

 

If I use selector "N\\A" it catches N\A, so it seems like it requires an escape character.  It seems like the display style of the case structure isn't what I'm expecting, but I don't see a way to explicitly set it, like I can with an integer selector.

 

Assuming I'm on the right track with the display style, I still am not reconciling why "N\A" gets replaced with "N\n"    A regular string control set to \ Display will also convert "\A" to "\n".  Can someone explain this to me or point me to the documentation?

--
Tim Elsey
Certified LabVIEW Architect
Message 1 of 18
(4,773 Views)

Interesting...It looks like the string case selector is always in \ Codes mode.  The "\a" to "\n" makes sense to me since \a is actually character 0xA = Line Feed.

 

After digging for a little bit, the \ Codes is mentioned under the "Enumerated Values" section of the table in the "Entering Values for Each Case Structure Subdiagram" help page.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 18
(4,758 Views)

I may be being picky here but I assume your "N\A" case is short for "Not Appropriate" ?

 

Shouldn't that be abbreviated as N/A (forward slash) not N\A (back slash)

 

BTW: The forward slash works fine as a case

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 18
(4,694 Views)

@RTSLVU wrote:

I may be being picky here but I assume your "N\A" case is short for "Not Appropriate" ?

 

Shouldn't that be abbreviated as N/A (forward slash) not N\A (back slash)

 

BTW: The forward slash works fine as a case


Your assumption is right.  And it should be N/A, but I cannot count on my field engineers not to type N\A or NA, so I was putting those all in the selector. 

--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 4 of 18
(4,688 Views)

@elset191 wrote:

@RTSLVU wrote:

I may be being picky here but I assume your "N\A" case is short for "Not Appropriate" ?

 

Shouldn't that be abbreviated as N/A (forward slash) not N\A (back slash)

 

BTW: The forward slash works fine as a case


Your assumption is right.  And it should be N/A, but I cannot count on my field engineers not to type N\A or NA, so I was putting those all in the selector. 


You know that is what the "Default Case" is for, right?

 

Any case selector not defined will use the default case.

========================
=== Engineer Ambiguously ===
========================
Message 5 of 18
(4,685 Views)

@RTSLVU wrote:

You know that is what the "Default Case" is for, right?

 

Any case selector not defined will use the default case.


Unfortunately, that will also accept "asl;dkhgdsk;h f;kajshd fklashfdklj;c" unless you actually handle that string.  Default should usually be an error when dealing with input strings.  But from what I have been able to find, the case should be "N/A","N\\A","NA" and preferably with the case insinsitive option selected for the case structure.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 18
(4,645 Views)

@crossrulz wrote:

But from what I have been able to find, the case should be "N/A","N\\A","NA" and preferably with the case insinsitive option selected for the case structure.

Yes, standard rules for escaping special codes apply (should be mentioned on the help page!)

 

 

 

Message 7 of 18
(4,640 Views)

@RTSLVU wrote:

@elset191 wrote:

@RTSLVU wrote:

I may be being picky here but I assume your "N\A" case is short for "Not Appropriate" ?

 

Shouldn't that be abbreviated as N/A (forward slash) not N\A (back slash)

 

BTW: The forward slash works fine as a case


Your assumption is right.  And it should be N/A, but I cannot count on my field engineers not to type N\A or NA, so I was putting those all in the selector. 


You know that is what the "Default Case" is for, right?

 

Any case selector not defined will use the default case.


Default is pretty much the opposite of what I want in this case.  N/A and its derivatives is the only explicit case, with everything else being handled as default.  That way I don't have to make a case for every instrument name we might ever use. 

--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 8 of 18
(4,607 Views)

I would add some error check either where the code is entered into a string, or on the string before the case structure that searches for N\A or any of its variants and replaces them with N/A.

0 Kudos
Message 9 of 18
(4,600 Views)

@elset191 wrote:

@RTSLVU wrote:

@elset191 wrote:

@RTSLVU wrote:

I may be being picky here but I assume your "N\A" case is short for "Not Appropriate" ?

 

Shouldn't that be abbreviated as N/A (forward slash) not N\A (back slash)

 

BTW: The forward slash works fine as a case


Your assumption is right.  And it should be N/A, but I cannot count on my field engineers not to type N\A or NA, so I was putting those all in the selector. 


You know that is what the "Default Case" is for, right?

 

Any case selector not defined will use the default case.


Default is pretty much the opposite of what I want in this case.  N/A and its derivatives is the only explicit case, with everything else being handled as default.  That way I don't have to make a case for every instrument name we might ever use. 


I guess I kind of see your point, I think I did something similar before for configuring instruments in a test rack, but I guess I feel the other way.

 

Since different instruments need to use different VI's to control them, (For instance in my test systems there could be any of three different DC power sources so there is a case for every possible instrument) the "None" or in your case "N/A" is my default case, and does nothing.

 

That way it is fail safe if someone fat fingers in a configuration error.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 10 of 18
(4,592 Views)