10-06-2020 03:09 PM
Hi everyone!
I'm trying to Update a old Script from Diadem 9.1 and I'm getting some troubles. The Script use to Copy the Root Properties of some .tdms files were the conditions of the test are stored. For that it used the command .RootPropCount, that now is obsolete.
I tried the following Script to get this Count but I do not get the count of the Custom Properties:
Solved! Go to Solution.
10-07-2020 02:40 AM
This is a little pitty because the RootPropCount was doing a second thing internally which was calling
rootProperties.ListInstanceProperties = True
This little line causes the API to also reflect the custom properties (instance properties).
You need to set it to true for every properties object.
So the following code will do the job.
Option Explicit
dim TdmHdr, oMyDataStore, PropCount
Set TdmHdr = CreateDataFileHeaderAccess()
Set oMyDataStore = TdmHdr.Open(DataReadPath & "EXAMPLE.TDMS" , "TDMS", True)
dim rootProperties : set rootProperties = oMyDataStore.RootElements(1).Properties
rootProperties.ListInstanceProperties = True
PropCount = rootProperties.Count
MsgBox (PropCount)
maybe you can just add a function to your code to simplyfy the job
Option Explicit
dim TdmHdr, oMyDataStore, PropCount
Set TdmHdr = CreateDataFileHeaderAccess()
Set oMyDataStore = TdmHdr.Open(DataReadPath & "EXAMPLE.TDMS" , "TDMS", True)
dim rootProperties : set rootProperties = GetElementProperties(oMyDataStore.RootElements(1))
PropCount = rootProperties.Count
MsgBox (PropCount)
function GetElementProperties(byref element)
set GetElementProperties = element.properties
GetElementProperties.ListInstanceProperties = True
end function
10-07-2020 04:24 AM
Thank you very much!! Now it works fine.