Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Comparing 2 records
Message
From
28/07/2005 08:42:25
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01036517
Message ID:
01036538
Views:
11
I'm going to post a modified version of it anyway. Maybe someone else will find it useful. This one doesn't create a file of differences, but you could do any action you want once you know there is a difference. Like replacing a field value from one table into the other. The GETFILE could easily be removed and replaced with whatever tables you needed to run against.
m.FirstTable = GETFILE('DBF','Select FIRST table','Select')
m.SecondTable = GETFILE('DBF','Select SECOND table','Select')

ldifferent = .F.

USE (m.FirstTable) IN 0 ALIAS First
USE (m.SecondTable) IN 0 ALIAS Second

SELECT First
SET RELATION TO RECNO() INTO Second

SCAN
	FOR i = 1 TO FCOUNT()
		IF FIELD(i,'First') <> FIELD(i,'Second')
			* DO UPDATES
			ldifferent = .T.
		ELSE
			IF EVAL('First->' + FIELD(i,'First')) <> EVAL('Second->' + FIELD(i,'Second'))
				* DO UPDATES
				ldifferent = .T.
			ENDIF
		ENDIF
	ENDFOR
ENDSCAN
>Thanks, Jay, but I'm trying to "keep it in the family" so to speak. I don't want the user to be involved, or add any more functionality/interfaces. I'll have a go with Sergey's suggestion of CompObj().
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform