09-12-2012 06:44 PM
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?
09-13-2012 02:13 AM - edited 09-13-2012 02:15 AM
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, "&", "&") & "</filename>" & additionalParameters,"CSV") end if
The following script will do the job.
Greetings
Andreas
09-18-2012 09:56 AM
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>
09-19-2012 01:16 AM
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.
09-19-2012 05:00 AM
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, "&", "&") & "</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.
09-19-2012 05:16 AM
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, "&", "&") & "</filename>" & additionalParameters,"CSV")
Works for me. While "C:\temp" exists on my machine.
Which DIAdem Version do you use.
09-19-2012 05:34 AM
I don't use Option Explicit.
I use 10.1 Version.