Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Replication
Message
From
22/10/1997 07:25:13
Matt Mc Donnell
Mc Donnell Software Consulting
Boston, Massachusetts, United States
 
 
To
22/10/1997 06:51:56
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00055965
Message ID:
00055969
Views:
28
>>>How would I maintain a replica of a .dbf in a second location?
>>>
>>>I only want the changed data to be updated.
>>>
>>>TIA
>>
>>Add Code to the triggers to add/edit/delete same information in second table.
>
>Could you give me an example? I've never done that.

Well, I'll give you a start, if I can:

First, your tables will need to have a primary key defined.

Then in the Trigger boxes, call these procedures:
PROC CopyUpdate
LOCAL llReturn

SELECT MyTable2  && assume order set to PK
SEEK MyTable1.PK
IF FOUND()
  REPL Field1 WITH MyTable1.Field1, ; 
       Field2 WITH MyTable1.Field2, ;
       Field3 WITH MyTable1.Field3, ;
       Field4 WITH MyTable1.Field4
  llReturn = .T.
ELSE
  llReturn = .F.
ENDIF

SELECT MyTable1

RETURN llReturn

PROC CopyInsert

INSERT INTO MyTable2 ( PK, Field1, Field2, Field3, Field4) ;
       VALUES (PK, Field1, Field2, Field3, Field4)

RETURN .T.

PROC CopyDelete
LOCAL llReturn

SELECT MyTable2  && assume order set to PK
SEEK MyTable1.PK
IF FOUND()
  DELETE
  llReturn = .T.
ELSE
  llReturn = .F.
ENDIF

SELECT MyTable1
Obviously, you'll need code for buffering and messaging, but that should give you an idea.

HTH
Matt McDonnell
...building a better mousetrap with moldy cheese...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform