LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

why does Labview insert quotations in the case structure selector box?

I was building a case structure with an array of strings.  So, I copied the strings from the array on the FRONT PANEL directly into the SELECTOR LABEL.  My 3 strings have the form; to me, these are 5- character strings with spaces, or 7 characters if you count the spaces as string characters 

 

A, B, C   

A, B, D

A, B, E

 

So, when I copied and pasted them directly into the selector box A, B, C appeared as "A", "B", "C" and A, B, D appeared as "A", "B", "C" and then I got an error for selector values not unique.  Why didn't it appear as "A, B, C"?

 

Why did it transform the string I pasted and insert the quotation marks?  I used no quotation marks in my array.  Does the selector label interpret commas as functional characters that require quotation marks??

 

Thanks,

Dave 

0 Kudos
Message 1 of 7
(3,536 Views)

Try using Ring enum to which may solve your case. Insted of trying with string directly to the case structure. 

 

 

0 Kudos
Message 2 of 7
(3,530 Views)

Can you post your vi

0 Kudos
Message 3 of 7
(3,516 Views)

@dav2010 wrote:

I was building a case structure with an array of strings.  So, I copied the strings from the array on the FRONT PANEL directly into the SELECTOR LABEL.  My 3 strings have the form; to me, these are 5- character strings with spaces, or 7 characters if you count the spaces as string characters 

 

A, B, C   

A, B, D

A, B, E

 

So, when I copied and pasted them directly into the selector box A, B, C appeared as "A", "B", "C" and A, B, D appeared as "A", "B", "C" and then I got an error for selector values not unique.  Why didn't it appear as "A, B, C"?

 

Why did it transform the string I pasted and insert the quotation marks?  I used no quotation marks in my array.  Does the selector label interpret commas as functional characters that require quotation marks??

 

Thanks,

Dave 


Actually in CASE STRUCTURE, any frame can have multiple values as 'Case Selector value' and these are separated by a comma. Also if you choose to operate a CASE STRUCTURE using string, it will automatically prefixs & suffixs quotes (") to that string.

 

But you can enter  "A, B, C" manually and it will remain as it is. But if you copy and paste A, B, C, the CASE STRUCTURE will automatically change it to "A", "B", "C".

 

Case Structure


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


0 Kudos
Message 4 of 7
(3,502 Views)

@dav2010 wrote:

I was building a case structure with an array of strings.  So, I copied the strings from the array on the FRONT PANEL directly into the SELECTOR LABEL.  My 3 strings have the form; to me, these are 5- character strings with spaces, or 7 characters if you count the spaces as string characters 

 

A, B, C   

A, B, D

A, B, E

 

So, when I copied and pasted them directly into the selector box A, B, C appeared as "A", "B", "C" and A, B, D appeared as "A", "B", "C" and then I got an error for selector values not unique.  Why didn't it appear as "A, B, C"?

 

Why did it transform the string I pasted and insert the quotation marks?  I used no quotation marks in my array.  Does the selector label interpret commas as functional characters that require quotation marks??

 

Thanks,

Dave 


How did you copy A, B, D? I guess you didn't copy properly and thats why again you got the value A, B, C. Case structure must be unique, if you have the same value in 2 that is an error.

 

The string inside the quotes will be considered as the case selector value. Apart from numeric data type other values will showup with the quotes by default.

 

If you have case like "A", "B", "C" then that case will execute only when A or B or C comes alone (remember case structure is case sensitive).

 

If you have case like "A, B, C" then this case will execute only when A, B, C comes in with the same order. To be simple whatever inside the quotes is considered as a single value

-----

The best solution is the one you find it by yourself
0 Kudos
Message 5 of 7
(3,485 Views)

Hi,

 

"you didn't copy properly'.  What is the proper way to copy?  For example, I have an array, and the three strings in that array are

 

A, B, C

 

A, B, D

 

A, B, E

 

So, I use the EDIT TEXT tool on the tools pallete, to highlight the string inside the array and I press CTRL C.  Then, I move to the blank selector label and click into as if I am going to type test, and then I press CTRL V, and the string appears, as it was shown in the array on the FRONT PANEL, however, when I advance to the next case selector value, the quotation marks are added.  Yes, I understand that the case structure selector values must be unique.  Mine are unique, e.g. A, B, C is not the same as string as A, B, D...the two strings are unique, however, Labview is transforming what I copy with quotation marks, and then seeing "A" in both of them and calling it "not unique".

 

Instead, what seems to work is to manually enter " in the selector box, paste with the CTRL V command, then, add a closing set of ", and in this method, the "A, B, C" and "A, B, D" show up as expected, the "not unique" error goes away.  Is there any way to disable the automatic quotation marks so I don't have to manually enter quotations marks in every selector value?

0 Kudos
Message 6 of 7
(3,466 Views)

When dealing with the case structure selector, commas are shorthand to separate different strings (or numbers) when creating a case that could run for multiple values. If your actual string that you want to match contains commas, then you will want to place quotes around the string as you enter or copy it into the case selector.

 

So if you want a single case to run for *three* different possible values of A, B, or C, then type A, B, C.

If you want a single case to run for the *single* string "A, B, C", then type "A, B, C".

Message 7 of 7
(3,450 Views)