LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TDM Search Files

I would like to search many files for data (text entry) and return a list of files that contain the text.  I am considering using TDM or TDMS but I can't find any examples of doing data searches.  Speed and performance is not a concern so I am looking at TDM.  I dont see a way to set a directory and search within the directory for specif information.  I do not want to use DIAdem for this application.
 
 
Matt Fitzsimons
NI Alliance Member
LabVIEW Champion
NI Certified LabVIEW Architect
LabVIEW, LV-RT, Vision, DAQ, Motion, and FPGA
0 Kudos
Message 1 of 6
(3,705 Views)

Hi Matt,

From my understanding of what you are trying to do here, I believe this can be done by carefully using the List Folder VI from the File I/O >> Adv File Functions palette.  In using this VI you would need to include *.tdm as the pattern input, which would in turn populate an output array with all of the files in that directory with that extension.  This array will have all of the TDM files listed as strings which you can then build a path for each file to parse through for your desired text.  It should only look for that extension in the top directory, so if there are sub directories that also need to be searched, then you can get a list of these directories and perform this same search.

I hope this helps.  Regards,

Jason W.

National Instruments
Applications Engineer
0 Kudos
Message 2 of 6
(3,682 Views)
Hey Matt,

Jason's suggestions are quite valid as always, and should serve your purpose for this application, though as Jason mentioned you'll need to do quite a bit of configuration to be able to appropriately parse through files within directories (and potentially sub-directories). 

I know that you mentioned that you would prefer not to use DIAdem to do this, but may I ask why?   DIAdem is a wonderful and simple-to-use tool for an application like this that requires Advanced Querying within files across directories or entire hard-disks.   Can we answer any questions that will ease your mind about using DIAdem for this functionality?




Message Edited by Derrick S on 12-19-2007 11:17 AM
Derrick S.
Product Manager
NI DIAdem
National Instruments
0 Kudos
Message 3 of 6
(3,659 Views)

All,

 

Unless I am missing something this doesn’t answer my question.  I need to generate a list of files that that contain information about the equipment tested within the file and not in the file name.  List file will filter the names of the file and not the data within the file.  The reason I am not using DIAdem is that I have a very simple requirement to list the files and I don’t need to mine the data for information.  Let me know if there is a way without having to open every file.

Matt Fitzsimons
NI Alliance Member
LabVIEW Champion
NI Certified LabVIEW Architect
LabVIEW, LV-RT, Vision, DAQ, Motion, and FPGA
0 Kudos
Message 4 of 6
(3,641 Views)
Matt,
 
To clarify, LabVIEW sees these files as a black box in that it has no information of its contents unless the file is opened.  Therefore, my suggestion for doing this within LabVIEW is to use the List Folder VI to locate the TDM files that you have, and then open them up individually to search for your desired data.  Without using an application like DIAdem which has already polled for this information, there is not shortcut for conducting this in LabVIEW.
 
Jason W.
National Instruments
Applications Engineer
Message 5 of 6
(3,617 Views)
I would agree with Jason.  While this may seem like a fairly basic operation to just "list the files containing the correct information" from the eyes of the programmer, it's actually pretty detailed.  In order for LabVIEW to gain access to the metadata of the files you're trying to search, a few steps are going to be involved.  As Jason suggested, if you'd like to achieve this In LabVIEW, you'd have to programmatically:
  1. Open each file
  2. Parse through its contents to determine whether or not it matches the criteria you seek
  3. Close the file
  4. then Iterate to the next file in the set.
In a way, you're creating your own custom indexer to retrieve the desired information from your set of files.

The reason I suggested DIAdem for this application is that, as I previously stated, this is basic functionality within DIAdem - the work is all done for you behind the scenes (hence the "mining" of data that you describe) by the DataFinder that uses minimal system resources in the background to index your data  That way, when you need to quickly search for certain criteria and list the files that apply to the situation, a programmatic routine like the one above isn't necessary; DIAdem simply references the information it has already collected in the course of its indexing.  I think this is perhaps one of DIAdem's strongest points - ease of data management

I hope this helps clarify the situation!
Derrick S.
Product Manager
NI DIAdem
National Instruments
Message 6 of 6
(3,606 Views)