DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read csv Data and save it with no format changes

Hi,

 

At first I am not used to Diadem.

I want to read in a csv file do some calculation with the data and save the changed data in the same csv file. A file as an example is attached (496888_edit.csv).

Therefore I wrote this lines:

 

Dim i
Dim Delimiter
Dim FilePath
Dim FileParameters
Delimiter = ";"

Call DataFileLoad(FilePath,"CSV","Load")
' Do some calculations
FileParameters = "<filename>"&FilePath&"</filename>"&"<delimiter>"&Delimiter&"</delimiter>"
Call DataFileSave(FileParameters,"CSV")

After running that lines the csv file is looking like the other attached file (496888_after.csv)

 

Because of some reasons which I could not explain Diadem is rounding the numbers. I want that both files look the same.

What can I do?

 

There might be another extension. Just to read in some columns, doing some calculations and after the calculation saving that columns in the file instead of the originals. (The csv files are much bigger like the two examples)

 

Thanks,

Jens 

Download All
0 Kudos
Message 1 of 2
(5,615 Views)

The only thing that can be changed in writing float64 values using the CSV plugin is the decimal point ('.' or ',').

The format of the doubles is not rounded but the CSV writer only writes the relevant digits.

It is using up to 15 digits which is the resolution of float 64. It would also switch to scintific writing if necessary.

 

So there is no way to force only 6 digits and filling 0s are left out. So if you just fear that you loose precision that will not happen.

(only the typical problems of epressing a 2 system binary value in a 10 system text string)

 

If you are interested to have a fix float format the only solution is to write with VBS directly to a file doing formatting on your own, which is slow.

 

0 Kudos
Message 2 of 2
(5,599 Views)