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.
' 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
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?