LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

decimal places lost when building array

Hello,
 
I am trying to write data that gets built into an array to a SQL database.  Everything works great except for the numbers which contain more than 2 decimal places.  These numbers get rounded to two decimal places after being built into an array.  I can change an indicator after the array to display more than 2 decimal places...but this has no effect on the data written to the database.  It seems like it should be something fairly simple, something obvious that I am missing......can anyone help me?
 
thanks,
 
 
 
Andrew
0 Kudos
Message 1 of 7
(4,480 Views)
Hello,

See the precision on the indicator (right click, property). Or a simple way it's if you post an example. then i can change it for you.

I can only post labview versions 8.0 and 8.2
Software developer
www.mcm-electronics.com





PORTUGAL
Message 2 of 7
(4,472 Views)
There are a couple things to check.
  1. Look at the code that is formatting the numbers for insertion into the database.
  2. Check the precision of the numeric field that the data is being inserted into. Real numbers in databases are typically stored as fixed-precision numbers.
  3. Look at the code that is reading the data to make sure is it preserving the full precision in the database.
What database are you using, how are you communicating with it?
What is the datatype of the column the data is being inserted into?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 3 of 7
(4,466 Views)

Here is an example of the code. Like I mentioned earlier I can change the indicator to display more digits but the data going to the database still stays in the format of 2 places after the decimal place.  In this example I made 2 indicators, and if I change the precision on 1 of them, it still only has 2 digits that is displayed on the other and only 2 digits get written to the database

 

 

0 Kudos
Message 4 of 7
(4,457 Views)
The example doesn't show anything because there is only one subvi on it - which you didn't include.

Did you check the other things I suggested? What are the answers to the other questions I asked?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 5 of 7
(4,449 Views)
I think I found the issue.  there is a statement %0.2f tied to a format into string function before it gets made to a SQLstatement inside of the SQL.vi.  This was part of a vi that I copied over.  I can t find anything in the help section on how to define formats, is this likely the problem? and what would be the way to give this 8 decimal places? %.8f?
 
 
Thanks,
 
 
Andrew
0 Kudos
Message 6 of 7
(4,449 Views)

I found the issue, it was the formatting of an array control in the final sub vi.  It was set to 2 digits of precision.  Thank you all very much for the help, it pointed me right towards it.  I finally found the help section on format specifiers also, and even though that was nt the issue, I will need to read over that topic.

 

 

Andrew

0 Kudos
Message 7 of 7
(4,440 Views)