08-20-2021 03:29 PM
Hi,
Can someone please tell me how to handle a time/date format in the Text DataPlugin Wizard with a timestamp like this: 09:40:00 Fri 08/06?
I've tried hh:mm:ss www but it doesn't yield the needed result. Also, I am not sure how to handle the spaces.
Thanks,
Jim
08-21-2021 05:34 PM
Hi Jim,
DIAdem has a corresponding datetime format for that "Fri" component, but the DataPlugin api does not. If you're willing to post or send me a sample data file, I can see how much effort it would be to create a VBScript DataPlugin from scratch-- the wizard will not succeed with this datetime format, but it is possible to parse this with VBScript.
Brad Turpin
Principal Technical Support Engineer
NI
09-02-2021 02:11 PM
Hi Brad,
Here is a simple example file. Is it possible for the DataPlugin to be done in Python instead of VBS?
Thanks,
Jim
09-03-2021 02:08 PM
Hi Jim,
Here's a VBScript DataPlugin that reads the one data file you posted. I'm faster with those than python DataPlugins still, and I hope you'll agree that the source code is impressively simple, due to the VBScript DataPlugin helper objects.
Sub ReadStore(File)
Dim j, jMax, Delim, Block, Group, Channel, ChanNames
Delim = ","
File.Formatter.Delimiters = Delim
File.Formatter.LineFeeds = vbCRLF
File.Formatter.TimeFormat = "hh:mm:ss Fri MM/DD"
Set Group = Root.ChannelGroups.Add(File.Info.FileName)
ChanNames = Split(Delim & File.GetNextLine, Delim)
jMax = UBound(ChanNames)
Set Block = File.GetStringBlock()
FOR j = 1 TO jMax
IF j = 1 THEN Set Channel = Block.Channels.Add(ChanNames(j), eTime)
IF j > 1 THEN Set Channel = Block.Channels.Add(ChanNames(j), eR64)
Call Group.Channels.AddDirectAccessChannel(Channel)
NEXT ' j
End Sub
Brad Turpin
Principal Technical Support Engineer
NI
09-13-2021 10:12 AM
Thanks Brad!