DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

root properties in connected data store: error when accessing storage date/time

Solved!
Go to solution

When browsing through the properties of my connected data store I get an error message when trying to read the property value of "storage date/time": Object doesn't support this property or method.

Here is a minimum example:

 

Dim oMyDataStore, MyProperty, oMyProperties
Set oMyDataStore = Navigator.ConnectDataStoreByParameter("TDM", "<filename readonly=""yes"">"& "C:\Program Files (x86)\National Instruments\DIAdem 2012\Examples\Data\Example_data.tdm" & "</filename>")
Set oMyProperties = oMyDataStore.RootElements(1).Properties
For Each MyProperty in oMyProperties
  Call MsgBoxDisp("Property name: " & MyProperty.Name & vbCrLf & "Property value: " & MyProperty.Value)
Next

 

Why can I not access this particular default property?

0 Kudos
Message 1 of 3
(5,210 Views)
Solution
Accepted by topic author Phex

Hi Phex,

for date/time properties an object called UsiTimeDisp is returned. This object allows you extended service functionality like accessing each part (day, year, hour, seconds, ...) of your date/time value separately. If you want to print the date/time value with MessageBoxDisp you can use the VariantDate property of this object.

 

Your code could look like this then:

Dim oMyDataStore, MyProperty, oMyProperties
Set oMyDataStore = Navigator.ConnectDataStoreByParameter("TDM", "<filename readonly=""yes"">"& "C:\Program Files (x86)\National Instruments\DIAdem 2012\Examples\Data\Example_data.tdm" & "</filename>")
Set oMyProperties = oMyDataStore.RootElements(1).Properties
For Each MyProperty in oMyProperties
  If MyProperty.DataType = eTime Then
    Call MsgBoxDisp("Property name: " & MyProperty.Name & vbCrLf & "Property value: " & MyProperty.Value.VariantDate)
  Else
    Call MsgBoxDisp("Property name: " & MyProperty.Name & vbCrLf & "Property value: " & MyProperty.Value)
  End If
Next

 

I hope this helps.

Have a nice day,

Eva

0 Kudos
Message 2 of 3
(5,200 Views)

Hi Eva,

 

thanks for your help, appreciated.

 

/Phex

0 Kudos
Message 3 of 3
(5,196 Views)