DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing the value of the 'datetime'-property of a file without loading the file to the data portal

Solved!
Go to solution

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!

0 Kudos
Message 1 of 3
(761 Views)
Solution
Accepted by topic author alex_berlin

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

 

Message 2 of 3
(724 Views)

Thanks a lot - problem solved!

Best regards,

Alex

0 Kudos
Message 3 of 3
(716 Views)