11-19-2008 05:30 AM
Hi,
I m having a dialog box which is showing a number of folders in that, i want user to select any of the folder & that folder( all tha files) should be loaded in dataportal .is there any function available for that?
Thanks
Nidhi
11-20-2008 09:26 AM
Hi Nidhi,
The short answer is "Yes". Are you expecting the files in the folder to all be the same type of file, say "*.TDM", or might they have different file types (*.DAT, *.CSV, etc.)? The long answer is that there are several ways of returning a list of file paths inside a particular folder, and with each method you have the choice whether to filter that list of files to exclude unwanted file types (*.DOC, *.PDF, etc.). You would then loop through the file list and load each one with DataFileLoad(). Do you want them all in the Data Portal at the same time, or do you want to process each one separately, one after the other?
Brad Turpin
DIAdem Product Support Engineer
National Instruments
11-27-2015 02:23 PM
11-30-2015 09:05 AM
Hi Nidhi,
I recommend you look into the DirListGet() function. You can use it to return an array of all the subfolders in a main folder, or of all the files of a particular type in the main folder, like this:
StartFolder = ProgramDrv & "Examples\Data" FilePaths = DirListGet(StartFolder, "*.TDMS", "filename", "FullFilenames") iMax = UBound(FilePaths) FOR i = 0 TO iMax Call Data.Root.Clear Call DataFileLoad(FilePaths(i), "TDMS") ' Do your analysis here ' Export your results here NEXT
Brad Turpin
DIAdem Product Support Engineer
National Instruments
12-06-2015 01:36 PM
Hello Brad,
thanks, your input helped a lot!
Here is my solution for it:
1. Define a array of all folders in a directory
2. Define a array of files which I want to handle in each folder
3. Do similar calculations with the defined files in each folder
Dim vFoundFiles, iCount, i, Dateien, meinVerzeichnis, ReturnValue, Pfad meinVerzeichnis = "D:\temp" 'Startpfad festlegen ReturnValue = PathDlgShow("Verzeichnisauswahl...", meinVerzeichnis) Pfad = outputpath call FileNameGet("Any","FileRead", Pfad, "TDM data (*.tdm),*.tdm", "files.txt", False, "Data selection") 'Liste aller ausgewählter Dateien wird angelegt (und in txt file geschrieben) Dateien = Split(FileDlgFileName,"|") 'Split der mit "|" getrennten Dateinamen in Array vFoundFiles = DirListGet(Pfad, "*.*", "filename", "DirectorynamesRecursive") 'Array aller Ordnernamen im vorher definierten Verzeichnis wird angelegt If IsArray(vFoundFiles) Then For iCount = Lbound(vFoundFiles) to Ubound(vFoundFiles) call data.Root.Clear For i = 0 To Ubound(Dateien) 'Laden aller ausgewählter Datein (je Ordner) ins Datenportal call datafileload(vFoundFiles(iCount) &"\"& Dateien(i), "tdm") next '------------------------------------------------------------------------------------------------------------ 'Berechnungen call datafilesave(vFoundFiles(iCount) & "\" & "ergebnis", "tdm") '------------------------------------------------------------------------------------------------------------ Next End If
regards,
headni