LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scan from string: boolean input

Solved!
Go to solution

Hello to you all!

 

I've noticed strange (for me) behaviour of Scan from string function.

If I want to use it to read from string, but instead writing format string (%s %d %b (...) ) I want to declare type by connecting specific type corresponding to input. 

And when it comes to reading strings or digital - there's no problem, but with booleans for some reason, the function does not interpret 0 as False and 1 as true. If I connect the String Format with %b - it works fine... 


Here's the snipped:

 Scan_from_string.png

 

Is this a bug or known thing?

PS: apologies for my English - it's my 2nd language...

0 Kudos
Message 1 of 3
(4,486 Views)
Solution
Accepted by topic author AdamTrojak

0 and 1 is the binary representation of the boolean type. If you open the help file on a boolean control you will see that the the boolean type value are TRUE, FALSE. If your string contain TRUE, FALSE, T, F, True, False for examples it will be recognize as a boolean.

 

In your case if you don't want to use a format string you can use a U8 constant and use Not equal to zero.

 

scanFromString.png

 

Ben64

Message 2 of 3
(4,461 Views)

Oh... I see. Thank you for explanation. 

However I still think using 0 and 1 should be also considered for boolean type use;)

Message 3 of 3
(4,444 Views)