Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Producing an Update Log
Message
De
28/11/2014 10:27:07
 
 
À
15/10/2014 10:40:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01609383
Message ID:
01611521
Vues:
115
>>Hi All:
>>
>>I have been asked to produce a file with 300,000 records for viewing in SharePoint (of which I know little).
>>
>>Thereafter, instead of rerunning the generation of the file, the SP programmer wants me to produce an update log with Changes, Adds and Deletes. He would then use this file to update the master file.
>>
>>My idea would be to produce the current copy of the humongous file and then run a compare program that would generate the Update log. It goes without saying that each record has a unique PK.
>>
>>My questions:
>>
>>1. Does this appear to be a sound approach?
>>2. Is there a quicker way to compare records other than looping thru each field in the record?
>>
>
>If you have a table that contains the base records and you want to compare the current records, you can certainly use a query:
>
>
>SELECT MyRealTable.* ;
>   FROM MyRealTable ;
>     JOIN MostRecentCopy ;
>        ON MyRealTable.PK = MostRecentCopy.PK ;
>     WHERE MyRealTable.Field1 <> MostRecentCopy.Field1 ;
>             OR MyRealTable.Field2 <> MostRecentCopy.Field2 ;
>          .... ;
>    INTO CURSOR csrNewChanges
>
>
>You'll also need queries to find records you've added or deleted. And then, of course, when you're done, your current table becomes the most recent copy.
>
>Tamar

Tamar and Tore,

The code works well EXCEPT that please look at the following code that generates all the OR conditions:
lcCurr = lcDrive + 'Masters\' + tcFileType + '_CURR.dbf'
lcMRC = lcDrive + 'Masters\' + tcFileType + '_MRC.dbf'

lcFieldComparisonList = fieldlist(lcCurr, tcExpList)

	SELECT 'U', tc.* ;
		FROM (lcCurr) tc ;
		JOIN (lcMRC) tp ;
		ON tc.PK = tp.PK  ;
		WHERE &lcFieldComparisonList. ;
		INTO CURSOR curUpd

return

FUNCTION fieldlist(tcFileName, tcExpList)

LOCAL i, retparm, lcFileType, lcPrefix, lcExpList

lcExpList = tcExpList + ',adduser,adddate,addtime,lckuser,lckdate,lcktime'

lcFileType = IIF(PCOUNT() = 0, '', tcFileType)
lcPrefix = ''

retparm = ''

FOR i = 1 TO FCOUNT()

	IF FIELD(i) $ lcExpList
		LOOP
	ENDIF

	retparm = retparm + lcPrefix + 'tc.' + FIELD(i) ;
		+ ' <> tp.' + FIELD(i)
	lcPrefix = ' OR '

NEXT

RETURN retparm
I'm getting an error that the SQL statement is too long, probably because there are so many fields to process. How can I solve this?

Yossi
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform