Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function for verify dbfs

Status
Not open for further replies.

ivancs

Programmer
Jun 13, 2001
13
BR
Hi, I am developing a system and every week a have to change same dbf of my clientes. My idea is only send a new dbf and the system analyse if has to be change or not.Of couse if the new dbf was changed. how do i do this ???
 
Hi
1. You can first pack the old DBFs
2. Then issue a command to rename the oldDBF suitably.
3. Copy the new DBF (empty one)
4. Append from the OLD DBF suitably replacing fields or by general append

Hope this helps
ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
LET KNOW IF THIS HELPED. ENOUGH EXPERTS ARE HERE TO HELP YOU OUT! BEST OF LUCK :)
 
Hi,

If the dbf you mean is a fixed table with no updating from the client, you could issue a LUPDATE() function to compare client's table against yours.

David

 
[tt]
=adir(laOld, "x:\xxx\xxx\OLDDBF.DBF")
=adir(laNew, "y:\yyy\yyy\NEWDBF.DBF")
for x = 1 to 4
if laOld[x] <> laNew[x]
Use X:\xxx\xxx\OldDbf exclu
copy to X:xxx\xxx\olddbf.old
zap
pack
append from Y:\yyy\yyy\NewDbf
exit
endif
endfor
[/tt]
David W. Grewe
Dave@internationalbid.com
ICQ VFP ActiveList #46145644
 
the idea is
1- verify is the structure of the new dbf is the same of the old one
2- if .f. them modify the old dbf for iqual as the new one
3- verify the cdx files

My problem is how to compare the structure of the dbf and the cdx files.

my idea is to put into executable the structure of new dbf and them compare every time the client run's the program

The function has to read the new dbf from memory, compare the database, the index and if find any difference, them rename the old dbf 1 empty dbf from memory them append from old dbf. But i dont know how !?!?!
 
Appropriate command is
COPY TO old/newfile STRUCTURE EXTENDED
and compare in doubled cycle each field, each record.
First difference - you use Ramani or Dgrewe
resolutíon.
Index create always new.
 
Sorry doubled cycle - simply compare
oldfile.FIELD_NAME = newfile.FIELD_NAME and similarly
FIELD_TYPE, FIELD_LEN and FIELD_DEC for each record.
 
Still better:
func IDENTSTR
sele OLDFILE
COLD = afields(OLD)
dime OLD(COLD * 4)
sele NEWFILE
CNEW = afields(NEW)
dime NEW(CNEW * 4)
if CNEW = COLD
i = 1
do while i <= COLD * 4
if OLD # NEW
retu .F.
endif
i = i + 1
enddo
* old and new are identical
retu .T.
endif
retu .F.
(only idea, not tested)

 
Sorry, must be
if OLD[ i ] # NEW[ i ]
as [ i ] = to italics...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top