02-23-2011 05:32 PM
I'm using the Excel Get Data.vi from the report generation toolkit and see a -1 returned instead of the actual text value of "True"
I've tried formatting the Excel spreadsheet to "Text" to try and force it, but it always returns -1.
Any suggestions?
Thanks!
02-23-2011 05:33 PM
Almost forgot - Using Labview 2010 SP1
02-23-2011 09:07 PM
It's because True in Excel is not text. It is a boolean/numerical value that converts to -1. Likewise, False is not text, but a value that converts to 0.
If you type true or false in lower case in Excel, you'll see it automatically converts to all upper case. If it was text, it would remain exactly how you typed it.
If you want it to be text, format the cell in Excel to be text format instead of general or numeric.
02-24-2011 05:46 AM
Thanks for the reply... but the cell format (the entire workbook) is already formatted for Text.
This only happens with True. False shows up as "False" when detected.
I've highlighed the cell that contains "True" so you can see that it is set to "Text". I've also added the "False" with the returned data below.
Thanks.
02-24-2011 06:02 AM
Ok... it started detecting as a text cell after I edited the Excel sheet. I replaced "TRUE" with "TRUE" and I could see the text shifted to the right after the enter key was pressed instead of remaining in the center. It appears that Excel is not updating the format of the cells when the format changes.
Thanks for your help!
Ed.
02-24-2011 11:46 AM
Hey lclutchl,
Sorry you are having this problem! It seems to be fairly common with the use of the Excel Get Data vi. The example code posted on this Better Get Excel Data discussion forum illustrates another way to get data from a spreadsheet. It does not deal with all of the inherent Excel formatting (which is probably causing your troubles), and instead just pulls a string from each cell. I know it looks scary, but you can just make this a subvi in your overall function, and it will work the way you expect. Hope this helps!
Cheers,
kgarrett