02-20-2015 02:57 AM
Hello,
I run the same Script in Diadem Version 2012 and 2014. The Script include the function DateDiff() of 2 channels which are identified as a date-channel. In the Version 2012 the Script run without errors and in the Version 2014 the Script throw out a error because of overflow. In the Version 2014 it seems to be that the function DateDiff() does not support the TimeStamp, because if you convert the date into a String it works.
Is it possibly that in the new Version 2014 of Diadem the function DateDiff() does not support the format of TimeStamp?
For me it would be interesting because of the performance of huge data sets.
Thanks in advance,
Thomas
Solved! Go to Solution.
02-20-2015 01:52 PM
Hi Thomas,
DateDiff() is a VBScript function that compares two scalar datetime variables. It does not and can not natively compare all the values of two datetime channels in the Data Portal. Were you by chance using that function in the DIAdem Calculator?
Brad Turpin
DIAdem Product Support Engineer
National Instruments
02-23-2015 02:33 AM
Hello Brad,
sorry I have not express myself correctly. For sure the function DateDiff() only compare two variables and not the channel in all.
I have use the function in the VBS-Script and compare all rows of a channel particular, that means every single cell. I do not think that there is a chance of using the calculator, because the function is part of a bigger function which compare different cells in a channel.
(for both examples the channels date_time_stator and date_time_rotor are channels of a date)
Here a simple example of the script is not working in Diadem 2014:
Dim date_time_1, date_time_2, date_diff
Set date_time_1 = Data.Root.ChannelGroups("RACF").Channels("date_time_stator")
Set date_time_2 = Data.Root.ChannelGroups("RACF").Channels("date_time_rotor")
date_diff = DateDiff("s",date_time_1(1),date_time_2(1))
Here a simple example of the script is working in Diadem 2014:
Dim date_time_1, date_time_2, date_diff
Dim date_time_1_new, date_time_2_new
Set date_time_1 = Data.Root.ChannelGroups("RACF").Channels("date_time_stator")
Set date_time_2 = Data.Root.ChannelGroups("RACF").Channels("date_time_rotor")
date_time_1_new = str(date_time_1(1),"#YYYY-MM-DD hh:nn:ss")
date_time_2_new = str(date_time_2(1),"#YYYY-MM-DD hh:nn:ss")
date_diff = DateDiff("s",date_time_1_new,date_time_2_new)
It shows if you change the date into a string it works, otherwise the Error: "overflow" occurs.
The curios thing the same VBS-Script is working in Diadem 2012 and is working in older scripts very well!
Do you have a idea why?
best regards,
Thomas
02-24-2015 01:50 PM
Hi Thomas,
The variable subtype that is returned from a datetime channels has changed a bit through the DIAdem versions. Nowadays you have 3 choices for how to retrieve a particular row's value from a datetime channel:
Set TimeChannel = Data.Root.ChannelGroups(1).Channels(1) VbsDateTime = TimeChannel.Values(1) DIA_Seconds = TimeChannel.dValues(1) Set TimeObj = TimeChannel.oValues(1)
If you just want to compare the difference between two datetime values in seconds, I'd use the middle option above.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
02-27-2015 03:24 AM
Hello Brad,
thank you for your answer.
Thats a good option.
kind regards,
Thomas