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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to synchronize records between two tables

Status
Not open for further replies.

kosta

Programmer
Feb 9, 2001
186
CA
Hi all,

i'll develop a new app. one of terminal will be a laptop. application will be on each terminal pc and it'll read data from server (or server dedicated pc) . laptop user (sales team person) will add the sale or money received records his/her local data folder while customer vacation. after that when he/she come to main office he/she will synchronize his/her local data between server . main rule only newly added records (not found on server) will be copy to the server also can be starting day .

How would be the syntax for this ?

TIA

Soykan OEZCELIK
 
Tia,
I beg you pardon but as far I know the usual way to ask for help is to write down some code the way you think to proceed.
This forum is noy intended to act as 'brains' for you to develop a new application.
So once you put in your code you did write up to now, there will be helpfull people here to have a look at it.
-Bart
 
Sorry but if i had some code about it i dont ask and also i think forums is help area and there is from each level people. "brain" is not suitable word :)

Soykan OEZCELIK
 
Soykan,
In that case I should start to give the table an unique ID (integer).
Once you start to synchronise you could check for ID numbers which are not at the server but at laptop only. These can be added to the server.
Meanwhile I suggest to add a time-stamp to the records which will be refreshed every time you alter the record.
Depending on the value you are able to decide which records (both on server and laptop) are changed. These should be copied to server as well.

Does this help?
-Bart
 
Hi Nifrabar,
at the starting point i thought like you. time stamp is also good think . but i dont have any good code syntax :( if its possible would you like give here a small code sample via sample table structure ?

TIA

Soykan OEZCELIK
 
Code:
APPEND BLANK
REPLACE TimeDateField with DATETIME()

That said, you'll probably have time sync issues. I'd track the laptop name SYS(0) and a record ID in addition to a datetime.

Code:
Use LapTopDBF
SCAN
 SELECT LapTopDBF
 lcLapTopID=LapID
 lnRecordID=RecID

 SELECT ServerDBF &&has LapID+RecID index built
  SEEK(LapID+RecID)
  IF EOF() = .f.
   *add that record from laptop
   *an easy but slow way is
   APPEND FROM LapTopDBF for LapID+RecID=lcLapTopID+lnRecordID
  ENDIF
ENDSCAN

Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top