DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

ParseString

Hi

I was trying to use ParseString for converting the string datatype i read in a plugin.
I get a error when i try to convert it to a etime type, but it works fine when i use er32, ei16 etc. Can anyone tell me how can i correct this?

File.Formatter.ParseString(File.getcharacters(21),eTime)

Thanks,
Priya
0 Kudos
Message 1 of 3
(3,431 Views)
Hi Priya,

Parsestring uses the settings from the formatter object to read from the string. Please refer to the "TimeFormat" item of the formatter for more details (File.Formatter.TimeFormat = "DD.MM.YYYY hh:mm:ss"). If the format matches what you read from the file, it should read a time value without a problem.
Could you please let me know what the settings for "TimeFormat" are and what string you read from the file when you get an error?

Andreas
0 Kudos
Message 2 of 3
(3,421 Views)

Hi Priya,

VBS has the unpleasant little oddity that you have to use different assignment operators for objects than for normal values.  Thus you can write this for an integer:

  Dim MyInt : MyInt = 4

But you have to write this for an object:

  Dim MyObj : Set MyObj = Root.ChannelGroups.Add("MyChannelGroup")

Time is represented as an object in the DataPlugin API, in order to make it possible to set much smaller units of time than is possible with the native VBS time. This has the drawback that if you request a time from ParseString, you have to use the assignment syntax for objects. Check to make sure that your call to ParseString looks like this:

  Dim MyTime : Set MyTime = File.Formatter.ParseString(File.GetCharacters(21), eTime)

...and not like this:

  Dim MyTime : MyTime = File.Formatter.ParseString(File.GetCharacters(21), eTime)

Hope that helps,

Myrle
******************
For tips and tricks on creating VBScript DataPlugins go to http://dataplugins.blogspot.com.
0 Kudos
Message 3 of 3
(3,353 Views)