11-08-2023 06:21 PM
Hi,
I was originally trying to access the value of the 'datetime'-property of an MDF3-file without loading the file first, i.e. by accessing only the file header. But my approach doesn't even work with TDM-files.
I tried to follow the examples in DIAdem help to access the file header of an arbitrary example TDM file and I can successfully get e.g. the 'Name' and the 'DataType' of the 'datetime'-property. But when accessing the 'Value', I get an error message ("Object doesn't support this property or method").
Dim oMyDataFileHeaderAccess, oMyDataStore
Set oMyDataFileHeaderAccess = CreateDataFileHeaderAccess
Set oMyDataStore = oMyDataFileHeaderAccess.Open("C:\Temp\ExampleFile.TDM" ,"TDM", False)
msgbox(oMyDataStore.RootElements(1).Properties("datetime").Name) '--> okay
msgbox(oMyDataStore.RootElements(1).Properties("datetime").DataType) '--> okay
msgbox(oMyDataStore.RootElements(1).Properties("datetime").Value) '--> Error
However, after loading the same example file, the 'Value' can be read successfully e.g. by
msgbox(Data.Root.Properties("datetime").Value) '--> okay
So, I expect the 'Value' to be correctly embedded in the example file. (I also tried different files, always with the same problem.)
Can you please guide me to the correct approach of accessing the 'datetime'-property of TDM- or MDF3-files without loading them to the data portal? Thanks in advance!
Solved! Go to Solution.
11-10-2023 08:28 AM
Hi alex_berlin,
if you read out a value of a date/time property from a data store or assign a date/time value to the property of a data store, this property is a UsiTimeDisp type.
Use the set statement to assign an object to this property in order to continue working with the property.
Use the VariantDate object property to read or write date/time values in the VBS date format.
msgbox(oMyDataStore.RootElements(1).Properties("datetime").Value.VariantDate)
This should solve the problem.
Grüße
DIAdemo
11-10-2023 10:16 AM
Thanks a lot - problem solved!
Best regards,
Alex