DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Properties(wf_start_time ).Value cannot load from DataFileHeaderAccess?

Hi everyone,

 

I'm trying to extract metadata from a large volume of files, which I intend to use to create something like a diff log for channels, properties, and property values over this massive collection of files. 

 

Right now, my best plan is to use CreateDataFileHeaderAccess to retrieve channel names; and for each channel, retrieve each property (at least the relevant ones) and the values thereof.

 

Unfortunately, I'm running into an issue when I try to write the value of the property "wf_start_time", which yields the error "Object doesn't support this property or method." I've confirmed that the property exists, and if the data is loaded into the Data Portal, then Data.Root.ChannelGroups(grp).Channels(chn).Properties("wf_start_time").Value returns the correct value without an error. Is there something about DataFileHeaderAccess that doesn't play nicely with this particular property, and if so, does a workaround exist?

 

Sample code:

Dim filePath

Dim dataFileHeaderAccess : Set dataFileHeaderAccess = CreateDataFileHeaderAccess
Dim dataStore : Set dataStore = dataFileHeaderAccess.Open(filePath, "TDMS", True)

Dim channel0 : Set channel0 = dataStore.RootElements(1).Children(grp).Children(chn)

Dim channelP : Set channelP = channel0.Properties
channelP.ListInstanceProperties = True

Dim i, oProp
i = 0

For Each oProp in channelP
i = i + 1
Call LogFileWrite(i & vbTab & oProp.Name & vbTab & oProp.Value)
Next

This code will execute until it tries to write the "wf_start_time" property value, at which time it will throw the error. Changing the LogFileWrite output (e.g. skip the step if oProp.Name = "wf_start_time") will execute the code without error - but the waveform start time is one of the properties that I'd like to have. 

0 Kudos
Message 1 of 4
(1,546 Views)

Hi AnscombesQuartet,

 

Yes this seems to be a bug. I will send this info to R&D.

 

Thank you and greetings

Walter

0 Kudos
Message 2 of 4
(1,510 Views)

Thanks for checking. If it's useful, I'm using DIAdem 20.1.0f7908 SP1.

0 Kudos
Message 3 of 4
(1,505 Views)

The Property<DataStore> API differs slightly in behavior from the Property<Data> API used for loaded data.

  • ListInstanceProperties
  • Handling for DateTime Values. The same object as returned in DataStore API can be retrieved in Data Api by using oValue.
    To access the value in VBS you need to read the VariantDate from the USITimeDisp object. 
Option Explicit

Dim filePath : filePath = "C:\Users\Public\Documents\National Instruments\DIAdem 2021\Data\Example.tdms"
dim grp : grp = 2
dim chn : chn = 1

Dim dataFileHeaderAccess : Set dataFileHeaderAccess = CreateDataFileHeaderAccess
Dim dataStore : Set dataStore = dataFileHeaderAccess.Open(filePath, "TDMS", True)

Dim channel0 : Set channel0 = dataStore.RootElements(1).Children(grp).Children(chn)

Dim channelP : Set channelP = channel0.Properties
channelP.ListInstanceProperties = True

Dim i, oProp
i = 0

For Each oProp in channelP
    i = i + 1
    If IsObject(oProp.Value) Then
      'Date/Time value
      Call LogFileWrite(i & vbTab & oProp.Name & vbTab & oProp.Value.VariantDate)
    else
      'String, Float, or Integer value
      Call LogFileWrite(i & vbTab & oProp.Name & vbTab & oProp.Value)
    end if
Next

 

To solve your job you can think about using DIAdem Datafinder to do it and load the search result as channels.

 

loadpropertyaschannel.gif

 

0 Kudos
Message 4 of 4
(1,480 Views)