DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

comma as decimal separator

Hello,
 
in my vb script I export channel data into a csv file with a "." as decimal separator. I´m using the datafilesave command.
How can I change decimal separator from "." to "," ?
 
Regards,
Marcel


Message Edited by Goju on 06-09-2008 06:32 AM
0 Kudos
Message 1 of 8
(7,104 Views)
Hello Goju,

you can use the key "decimalpoint", like

Call DATAFILESAVESEL("<filename>D:\temp\EXAMPLE.csv</filename><decimalpoint>,</decimalpoint>","CSV","'[1]/Time' - '[1]/Speed'")

Greetings
Walter
0 Kudos
Message 2 of 8
(7,080 Views)
Hello Walter,
 
thank you for the solution. It works!
 
Regards,
Marcel
0 Kudos
Message 3 of 8
(7,074 Views)

Interesting (hidden?) feature!!

Is there a way to specify the "Delimiter" & "NoValueSign" aswell?

And perhaps also to add a unitrow easy?

Regards

0 Kudos
Message 4 of 8
(7,048 Views)
Hello Sabcat,

I only know the way to specify the delimiter.
It´s the same way like to specify the decimal separator. But instead of using <decimalpoint> (see example from Walter) you have to use <delimiter>, e.g. <delimiter>;</delimiter>.

Regards
Marcel


0 Kudos
Message 5 of 8
(7,031 Views)

Hi Sabcat,

You can temporarily rename the first channel to create header rows above the channels and temporarily rename the last channel to create channel header rows, such as unit information, then rename the channels back to their original values after the CSV export.  It's low-tech, but it works, and uses the full efficiency of the CSV data export, which runs in C++ code.  I have attached an example VBScript below which does this programmatically.  You will need to edit the DataFileSave() line to include the extra XML from the other posts to get your custom delimiter and comma options.  I don't know of any way to affect the NoValue text.

Brad Turpin
DIAdem Product Support Engineer
National Instruments

Message 6 of 8
(6,992 Views)

Thanks Walter,

I could use it to insert the separator "," instead of the "tab".

Is there a possibility to replace the Path "D:\temp\EXAMPLE.csv" with a textvariable ( T1 or tMyPath) with individual Path?

<filename>D:\temp\EXAMPLE.csv</filename>

 

Thanks and regards,

Multimeter_HIII

0 Kudos
Message 7 of 8
(1,329 Views)

@Brad_Turpin wrote:
 

Hi Sabcat,

You can temporarily rename the first channel to create header rows above the channels and temporarily rename the last channel to create channel header rows, such as unit information, then rename the channels back to their original values after the CSV export.  It's low-tech, but it works, and uses the full efficiency of the CSV data export, which runs in C++ code.  I have attached an example VBScript below which does this programmatically.  You will need to edit the DataFileSave() line to include the extra XML from the other posts to get your custom delimiter and comma options.  I don't know of any way to affect the NoValue text.

Brad Turpin
DIAdem Product Support Engineer
National Instruments


After all these years - still a big THANK YOU!

 

We have a customer who wants his data converted to CSV and in the second row the units. Made me puzzled. I even thought about to learn how to create an own Plug In. But here came the soluton, finally!
"Simply" put a "vbCRLF" after the last channel name and copy all the channel units into this "second row":

 

Dim Kanaele, Kanal, KanalUnit

Set Kanaele = Data.GetChannels("*")
KanalUnit = Kanaele(1).UnitSymbol
For Kanal = 2 to Kanaele.Count
  KanalUnit = KanalUnit & ";" & Kanaele(Kanal).UnitSymbol
Next
Set Kanal = Kanaele(Kanaele.Count)
Kanal.Name = Kanal.Name & vbCRLF & KanalUnit

Call DataFileSave(Path & CSVName & ".CSV")

0 Kudos
Message 8 of 8
(175 Views)