// Within a directory I have several dbf files named "week13.d"
// with the last two digits of the extension in the name being any number
// from 01 to 99. For example week13.d01, week13.d02 etc etc. there could be 99 files.
// So what I need to do is search the directory for each file.
// Open the file search for the names of
// other files which are listed in the "week13.d??" files.
// Then place the names of the files into a xbrowse.
// Then continue the search process until I have
all the names listed in the browse
// that are in the week13 files.
// The customer will then browse the list and select the files to process.
Harvey, You can do it different to my Solution, if You like :
1. Scan for all Files.
2. Display the Files in xBrowse.
3. Select the File.
4. Display the Field in another Browse
With this Solution, I collect all Infos from all DBF's
The Strings : Test1, Test2, Test3 will be Your Filenames.
1. I created the Dbf's => Week13.d01 - Week13.d05
2. each Dbf includes the Field INFO with Strings -> "Test1" - "Test3"
3. Next I scan with Directory for all Week13.d* ( the Array aDirectory includes all Filenames )
4. I open in a FOR NEXT each Dbf and add to the Array cList the File-Name and the Dbf-Field Info
- Code: Select all Expand view
#include "FiveWin.ch"
#include "xBrowse.ch"
#include "Directory.ch"
FUNCTION Main()
local oDlg, oBrw
local cList := {}
aDirectory := DIRECTORY("week13.d*")
n:= 1
FOR n := 1 TO LEN( aDirectory )
cFile := aDirectory[n][1]
DBSELECTAREA(1)
USE "&cFile"
DBGOTOP()
DO WHILE !EOF()
AADD( cList, { cFile, (1)->Info } )
DBSKIP( + 1 )
ENDDO
CLOSE
NEXT
DEFINE DIALOG oDlg SIZE 300, 200
@ 0, 0 XBROWSE oBrw OF oDlg ARRAY cList AUTOCOLS
oBrw:CreateFromCode()
oBrw:bKeyDown = { || oDlg:SetText( Str( oBrw:nColSel ) ) }
ACTIVATE DIALOG oDlg CENTER ON INIT ( oDlg:oClient := oBrw, oDlg:Resize() )
RETURN NIL
Best Regards
Uwe