main logo
Subject: Re: 2pt1 Gig Limit
Author: Dan Covill
Posted: 2003/09/23 11:16:00
 
View Entire Thread
New Search


At 01:11 09/23/03 -0400, Pete Theisen wrote:

>Now that *is* interesting! Any chance you might post the search code?
Pete:

Pretty simple, really. I won't post all the greasy details, but so you can
see what I'm doing. History files are all in one directory, name is of the
form "INV0301.dbf", containing invoices for January 2003.
----------------------
*-- Get a list of history files by date, newest first
private aFiles, Nfiles
Nfiles = adir(aFiles, 'ORDHIST\*.dbf')
if Nfiles = 0
do MsgBox with "No .dbf files in ORDHIST directory"
return
endif

wait window str(nfiles,3)+' history files' nowait
*-- Make aFiles ordered by file date descending
create cursor HistFiles (FNAME C(12), FSIZE N(10), FDATE D)
select HistFiles
append from array aFiles
index on FDATE descending tag FDATE
copy fields FNAME to array aFiles
use

*-- now search for the Invoice number
Minv = AskUserForInvoiceNumber()
for N = 1 to Nfiles
Dbname = 'ORDHIST\' + aFiles[N, 1]
wait window "Searching "+Dbname nowait
use (Dbname)
*-- If files are on a server, index them and use seek
locate for INVNO = Minv
if not found()
loop
endif
do WhateverYouWantTo
exit
endfor

return
*-------------------------------
You get the idea. You really want to do this on the machine where the
files are if using locate. Otherwise, index them and use seek.

Dan Covill







 
©2003 Dan Covill
<-- Prior Message New Search Next Message -->