From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Question on VB scripting in Diadem using Advanced Query

I'm a new Diadem user and I'm attempting to write a generic script that uses a Diadem Query (user-modifiable) in the Navigator to pull a set of tdms files.  This part of the program works, however, I'd like to understand the vb script to load the set of diadem files from the Navigator to the data portal.  The vb recorder uses the function "DataFileLoadSel" to load each file from the Navigator Search Results tab into the data portal.  The vb recorder creates a call to function "DataFileLoadSel" for each tdms file found by the Navigator.   My query pulled 93 tdms files and the vb recorder creates 93 calls instances in the vb script.   I'm looking for a more efficient/generic looping script that will read each tdms filename from the search results and with the filepath string, load the content of the tdms file into the data portal.  As indicated the looping structure would continue until all files have been loaded.

This seems to be a simple scripting exercise but I'm not finding any examples in the NI website that shows me how to do this in diadem.  It would seem that I should be able to with code pull the filename from the search results.

0 Kudos
Message 1 of 3
(2,202 Views)
' LOAD QUERY
Call Navigator.Display.CurrDataProvider.LoadQueryInfoSet("...path to query....TDQ", eQISModeQuery)

' RUN QUERY AFTRER LOADED
Call Navigator.Display.CurrDataFinder.QueryForm.Search()

' DEFINE FILE
Dim file

' LOOP THROUGH ALL FILES IN QUERY RESULTS
For Each file In Navigator.Display.CurrDataFinder.ResultsList.ResultsElements
  
  ' LOAD THE FILE
  ' Call Data.Root.Clear() ' Optional if you want to work on each file separately
  Call Navigator.LoadData(file)
  
  ' DO YOUR THING (Optional)
  
Next
' All files are loaded if you deleted the 'data.root.clear()' call
Message 2 of 3
(2,190 Views)

I am trying to do something similar to what your are doing.  I have multiple tdms files that I would like to pull one or two channels (data and time channel) out of and append them all in the DataPortal.  I have tried using the DataFileLoadSel with the Append parameter, but this always gives me an error when I loop through all my tdms files.  Could you provide your code if you got this working?

 

Thanks! 

0 Kudos
Message 3 of 3
(2,024 Views)