LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Excel Toolkit Get True False

Hi,

 

I am using the excel get data toolkit to get string.  It is reading in a for loop for a row by row read.  It is reading a string fine, but when the element is TRUE, the output is 0 in string.  When the element is FALSE, the output is -1 in string.  Why is that?  Why aren't I reading TRUE and FALSE instead.

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 4
(2,539 Views)

Because True and False in Excel cells aren't strings, they are special boolean datatypes.  If you happened to type in "true" (without the quotes) into a cell, you'll see it automatically changes to "TRUE".  Just like typing in "8/23" it will jump to "23-Aug" which is the default date/time format for Excel.

 

(Actually, I've always found the 23-Aug format very annoying and would prefer it gave me 8/23/10.  Does anyone know how to have Excel automatically format the date that way so that I don't have to go back and change the date format of the cell?)

Message 2 of 4
(2,529 Views)

Hi,

 

Thanks for the info.  How do I make it a non boolean string if I really need to use the word true and false?

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 3 of 4
(2,509 Views)

There are two options:

 

1. As Ravens Fan mentioned, you can put quotes around your TRUE and FALSE strings in Excel directly. This will likely be really tedious.

 

OR

 

2. Since you're reading line by line, you can check for a 0 or -1 are replace it with the TRUE and FALSE strings, respectively. This just requires a case structure after the read.

Tanya Visser
National Instruments
LabVIEW Group Manager
0 Kudos
Message 4 of 4
(2,498 Views)