03-05-2014 07:56 AM
I have the set of Data attached and I was trying to incorperate the Script below into my URI file so I can have it done for me on the import. My issue is I need the Channel "Queue_Time" to show up as a Time Channel only. I have tried to import the channel as a Time Channel however it does not show up correct and in turn messes with the rest of my Data calculations. What I need from the channel is just the Time portion alone. Running this below gets me what I need but like I said I would like to incorperate it into my URI so the load takes care of it.
Any help is always appriciated.
Dim Group
Set Group = Data.Root.ActiveChannelGroup
Call StringChanToDateChan(Group, "Queue_Time")
Sub StringChanToDateChan(Group, ChanName)
Dim DateStrgChannel, DateTimeChannel, Formula, Variables, ChanRefs
Set DateStrgChannel = Group.Channels(ChanName) : DateStrgChannel.Name = ChanName & "-DateStr"
Set DateTimeChannel = Group.Channels.Add(ChanName, DataTypeDate)
Formula = "DateTime = CDate(DateStr)"
Variables = Array("DateTime", "DateStr")
ChanRefs = Array(DateTimeChannel, DateStrgChannel)
Call Calculate(Formula, Variables, ChanRefs)
Call Group.Channels.Remove(DateStrgChannel.Name)
Call Data.Move(DateTimeChannel, Group.Channels,6) ' number at the end is the index it moves it to.
Call ChnRenumber
End Sub ' StringChanToDateChan()
03-06-2014 04:17 PM
Hi,
First, you can't attach code like that to the dataplugin. They only include dataplugin source code. They run once and don't run anything extra after they finish. If you could, I don't believe it would run when you wanted it to anyway. However, there may be other options based on your application. How big are the data files? Rows? Columns? If they are too large, we may have to see about splitting it up somehow. Also, which version of DIAdem are you using?
03-06-2014 05:23 PM
03-07-2014 03:58 PM
03-12-2014 05:32 PM
Hey J,
You actually haven't posted any data files yet. Would you please? It may still be possible to push this functionality into the DataPlugin used to load the data file.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
03-19-2014 02:31 PM
Hello,
Here is the data that I am using.
Thanks - J
04-01-2014 11:59 AM
Hi J,
It looks to me like you can do the time formatting in the DataPlugin just fine. Interestingly, the Call_Start_Time and Call_End_Time channels are configured in Excel as datetime columns and all the rest of the datetime columns are configured as strings. The attached DataPlugin converts all rows of those other datetime columns from strings to datetime.
Also, the kind of data you have here is what is called "record-based" data, meaning that the row affiliations are stronger than the column affiliations. Typically with this type of data you want to load selected rows from one or more files for analysis and reporting. I constructed this DataPlugin to support that scenario, but you'll need to index the files you want to use first and run a query to extract the desired rows.
Ask as you have questions,
Brad Turpin
DIAdem Product Support Engineer
National Instruments