04-26-2011 03:05 PM
I have a routine that do a fetch all on a csv file. If you use condition TPTemp=23, you will get row 5139. In that row, you have a value 0.98. However, depending on what you put in the csv file, you will get 0 for that number instead. What is going on?
04-27-2011 03:48 PM
First, what are the values for the "Columns" and the "Conditions" fields that make this occur?
Also, could the problem be occuring when you convert the variant to a string? Maybe you're loosing the fractional part in that conversion?
04-27-2011 04:06 PM
It happens all the time. It seems like the value is incorrect straight from the variant. Maybe when the program query the values as variant, it doesn't know what type of value it is, since it is in csv format?
04-27-2011 04:08 PM
What are the values for the "Columns" and the "Conditions" fields that make this occur? Maybe then I can see what is going on. Right now, I can't get the VI to run without those fields. I've been using the DB Toolkit a lot lately, so maybe I'll see something if I can get it to run!
04-27-2011 04:12 PM
Columns
*
Condition
TPTemp=23
04-27-2011 04:36 PM
For path, it is just the path of the file including the file name.
04-27-2011 06:31 PM
Hi jyang,
I have been working with your Vi and associated file.... Very interesting. It seems to be rounding down for this column but not for the other columns. I replaced 0.98 with 1.98 and instead of displaying the value at 0 it displays 1. An even stranger occurence is when I deleted the rows that did not satisfy the TPTemp=23 condition, it showed up as 0.98... So for some reason it decided to not round. I will continue to investigate this but I have a side question: why are you using the database Vi to access this excel file?
Good luck!
Jackie
04-27-2011 09:10 PM
Hi Jackie,
Thank you for much for looking into it. I am doing a sql query with a csv file, because I would like to only select rows that meet certain criteria, and I would like to make my code more transparent when I convert the program to query a real database table instead of a csv file
It seems like the values are not being read into an variant correctly. If you look at the variant, you will see that the values are incorrect. Is it possible that when the subvi read the csv file, it doesn't know what format the values are supposed to be in and misread them? Thanks!
Yik
04-27-2011 10:00 PM
If you change the value in the first row to '1.0', then it seems to read correctly.
04-27-2011 11:26 PM
I need to try it in the office when I get back in the morning. Can you elaborate a bit more on what you said? I want to try exactly what you said. Do you know why that would fix the problem? Thanks.