DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Export to CSV

Hello everyone,

I want to store all data in CSV file. Unfortunately it writes the time down as following:

 

08/12/2009 13:50:00.000000

 

I would like to have another format, like this:

 

12.08.2009 13:50:00.

 

P.S.: When I export it like xls file then the time is shown like I want. The time format settings of Diadem I changed like:

 

#dd.mm.yyyy hh:nn:ss

 

Can you please explain me why xls works and csv not?

0 Kudos
Message 1 of 7
(5,374 Views)

Hello,

 

I assue you are in geramny and you do not only want to change the time format but also decimal point and separator.

Option Explicit  'Forces the explicit declaration of all the variables in a script.

if "IDOk" = FileNameGet("Any", "FileWrite", "*.csv", "German CSV (*.csv),*.csv") then
  dim csvFileName : csvFileName = FileDlgFileName
  dim additionalParameters : additionalParameters = "<decimalpoint>,</decimalpoint><delimiter>;</delimiter><timeformat>DD.MM.YYYY hh:mm:ss.ffffff</timeformat>"
  Call DataFileSave("<filename>" & replace(csvFileName, "&", "&amp;") & "</filename>" & additionalParameters,"CSV")
end if

 The following script will do the job.

 

Greetings

Andreas

0 Kudos
Message 2 of 7
(5,361 Views)

Hello,

 

thanks for help.

But I've got an error message. That the file cannot be created. I set csvFileName = autoactpath & "\export\" & "test.xls".

<filename>csvFileName</filename><decimalpoint>,</decimalpoint><delimiter>;</delimiter><timeformat>DD.MM.YYYY hh:mm:ss.ffffff</timeformat>

 

0 Kudos
Message 3 of 7
(5,303 Views)

Does my attached script work out of the box?

 

Your line has to be

"<filename>" & csvFileName & "</filename><decimalpoint>,</decimalpoint><delimiter>;</delimiter><timeformat>DD.MM.YYYY hh:mm:ss.ffffff</timeformat>", "CSV"

 else the csvFileName is not threated like a variable.

0 Kudos
Message 4 of 7
(5,289 Views)

No, It's not.
I copied it to my skript like this:

  dim csvFileName : csvFileName = autoactpath & "\export\" & "test.xls"
  dim additionalParameters : additionalParameters = "<decimalpoint>,</decimalpoint><delimiter>;</delimiter><timeformat>DD.MM.YYYY hh:mm:ss.ffffff</timeformat>"
  Call DataFileSave("<filename>" & replace(csvFileName, "&", "&amp;") & "</filename>" & additionalParameters,"CSV")

And after starting it, I got an error message, that a file with name 

<filename>test.xls</filename><decimalpoint>,</decimalpoint><delimiter>;</delimiter><timeformat>DD.MM.YYYY hh:mm:ss.ffffff</timeformat>

cannot be created.

 

0 Kudos
Message 5 of 7
(5,281 Views)

Look currious. The target directory has to exist. It will not be generated.

 

Option Explicit  'Forces the explicit declaration of all the variables in a script.
dim csvFileName : csvFileName = "C:\temp\" & "test.xls"
dim additionalParameters : additionalParameters = "<decimalpoint>,</decimalpoint><delimiter>;</delimiter><timeformat>DD.MM.YYYY hh:mm:ss.ffffff</timeformat>"
Call DataFileSave("<filename>" & replace(csvFileName, "&", "&amp;") & "</filename>" & additionalParameters,"CSV")

Works for me. While "C:\temp" exists on my machine.

Which DIAdem Version do you use.

 

0 Kudos
Message 6 of 7
(5,276 Views)

I don't use Option Explicit.
I use 10.1 Version.

0 Kudos
Message 7 of 7
(5,271 Views)