01-15-2009 03:47 AM
Hello,
I have in my basic textfile the date and the time in different columns. Without making any changes in the original files, how can i merge date and time with Diadem?
I made a data plugin and have chosen the text format for the data and time columns. Now i want to create a new channel in the data plugin or as seperat script, wich merges the data and time to a new channel.
Example:
Channel 1 Data: 01.01.09
Channel 2 Time: 11:10
Channel 3 New Merged Data + Time: 01.01.09 11:10
How can i do that, i did't found anything in the help and at the net.
Thanks in advance.
01-15-2009 09:39 AM
Hi Marco,
I have a similar data file and NI helped me write a DataPlugin for this. I'm attaching my DataPlugin script. I think the main trick is using the "AddProcessedChannel" method (which is only available in DIAdem 10.2 and on I believe). There is some help available, but strangely only in the 10.2 help file, I could not find it in the 11 help.
My data file always has the first two channels as the Date and Time channels, so the DataPlugin checks for this (lines 19-22), and merges the first two channels together (lines 27-28). The final date channel format is set in line 9.
I hope this helps,
Julia
01-15-2009 05:49 PM
Hi Marco,
I was the NI person who wrote Julia's DataPlugin which uses the AddProcessedChannel method. Note that this only works in DIAdem 10.2 and later. If you'd like me to take a look at your ASCII file format and see if I can quickly create a DataPlugin for it, feel free to post it to this forum or email it to me directly at brad.turpin@ni.com.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
01-28-2009 02:54 AM
'*** How to Merge 2 Separated Date & time channels : Tested by Rako ***************
1) Load the data including the 2 separated Date and time channels in Dataportal c
Channel 1 Date: Named " tDate" . Example 01.01.09 defined as text
Channel 2 Time: Named as tHour : Example 11:10 defined as text
Channel 3 New Merged Data + Time : 01.01.09 11:10 defined as Time
2) launch the following script
' It assumes that you have 3 channels/Group named "New Time", "tDate" and "tHour"
dim iGrp, sDate, sHour, sFormat, ChnDate
For iGrp=1 to Groupcount
'*** Calcul et Conversion temps ***************
sNewTime= "Ch(""[" & iGrp & "]/New Time"")"
sDate = "Ch(""[" & iGrp & "]/tDate"")"
sSpace = " & "" "" & "
sHour = "Ch(""[" & iGrp & "]/tHour""))"
sFormat=", ""dd/mm/yyyy hh:nn:ss"")"
ChnDate = sNewTime & "=TTR((" & sdate & sSpace & sHour & sFormat
Call ChnCalculate(ChnDate)
Next
I hope it can work for you
Andre Rako. Helion Fuelcells / Aix FR