LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DB Tool Fetch RecordSet Data Bug?

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?  

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

Kudos and Accepted as Solution are welcome!
Download All
0 Kudos
Message 1 of 14
(2,952 Views)

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?

0 Kudos
Message 2 of 14
(2,930 Views)

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?

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

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

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!

0 Kudos
Message 4 of 14
(2,922 Views)

Columns

*

 

Condition

TPTemp=23

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

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 5 of 14
(2,920 Views)

For path, it is just the path of the file including the file name.  

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

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 6 of 14
(2,917 Views)

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

DAQ Product Marketing Engineer
National Instruments
0 Kudos
Message 7 of 14
(2,909 Views)

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

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

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 8 of 14
(2,906 Views)

If you change the value in the first row to '1.0', then it seems to read correctly.

0 Kudos
Message 9 of 14
(2,902 Views)

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. 

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

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 10 of 14
(2,899 Views)