DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Time/Date format for in Text DataPlugin Wizard

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

 

 

0 Kudos
Message 1 of 5
(2,736 Views)

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

0 Kudos
Message 2 of 5
(2,709 Views)

Hi Brad,

 

Here is a simple example file. Is it possible for the DataPlugin to be done in Python instead of VBS?

 

Thanks,

 

Jim

Message 3 of 5
(2,688 Views)

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

0 Kudos
Message 4 of 5
(2,675 Views)

Thanks Brad!

0 Kudos
Message 5 of 5
(2,637 Views)