03-05-2020 06:48 AM - edited 03-05-2020 06:52 AM
Hello community,
I am writing a script, which loads .mf4 files from a folder, reads them and writes a report.
As part of the report are the properties of the files such as "Comment" and "Date of recording".
I am reading them as follows:
for i=1 to Data.Root.ChannelGroups.Count
Set oCalcGroup=Data.Root.ChannelGroups.Item(i)
if oCalcGroup.Root.Properties.Exists("Kommentar") then
...
Now to the problem:
I can only access the Properties of the file when I read them with (oCalcGroup.Root.Properties). This means I am only accessing the Properties of the folder and consequently I have the same Properties for all the files I am trying to read. They are usually those of the first file in the folder.
When I try reading without root(as it should be I think:oCalcGroup.Properties ), there are only a few properties, which aren't the ones I need and arent the ones I see in CANape for example.
Thanks in advance!
03-18-2020 12:53 AM
Try the following simple example that iterates over file/root and channel group properties.
Dim oProp, oGrp, oChn
Call LogFileWrite("File / Root Properties:")
For Each oProp In Data.Root.Properties
Call LogFileWrite(vbTab & oProp.Name & vbTab & oProp.Value)
If Data.Root.Properties.Exists("MyGrpPropName") Then
'Do something with the file/root property
End If
Next
Call LogFileWrite(vbTab)
For Each oGrp In Data.Root.ChannelGroups
Call LogFileWrite("Properties for channel group '" & oGrp.Name & "':")
For Each oProp In oGrp.Properties
Call LogFileWrite(vbTab & oProp.Name & vbTab & oProp.Value)
Next
If oGrp.Properties.Exists("MyGrpPropName") Then
'Do something with the group property
End If
Next
The properties available are dependent upon the DataPlugin. Make sure you have the latest DataPlugin. http://www.ni.com/example/54290/en/
If you need another .mf4 file to try, try the sample file in this link:
Post one of your .mf4 files for more help.
03-24-2020 12:41 PM
Hi htdrv,
It sounds like you're trying to retrieve the file properties from multiple files that you've already loaded into the DIAdem Data Portal. The DIAdem Data Portal by default only loads the file properties of the first file loaded into it. By default the file properties from the subsequent files loaded into the Data Portal are not loaded at all.
If you are requesting the file property from elements in the NAVIGATOR panel browse tree view or Search Results list, then you have full access to all file properties, but again this is BEFORE you load the files into the Data Portal.
It is also possible to set the loading behavior to have File properties "trickle down" to the Group level, so that they do load into the Data Portal, just not at the File level.
The problem here is that the Data Portal only has 1 memory space for File properties.
Brad Turpin
Senior Technical Support Engineer
National Instruments