Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Producing an Update Log
Message
From
15/10/2014 14:21:46
 
 
To
15/10/2014 13:18:29
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01609383
Message ID:
01609473
Views:
84
>>>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
>
>Thanks! I suppose there is no way around the ORs, i.e. no loop or generic method. It could get quite long if there are, say, 50 fields in the table!
>
>Yossi

I am surprised that nobody suggested an audit file. In my newer application, I use business objects for all my tables. If I set the property LogChanges, records are added to a common Auditlog table whenever I change any data. This table has these fields:
Primarykey
Tablename
Fieldname
Oldvalue
Newvalue
Userid
Changetime

For added records, Oldvalue is null, for deleted records Newvalue is null.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform