Contents Index Synchronizing contacts in the Contact sample Monitoring statistics and errors in the Contact sample

MobiLink Synchronization User's Guide
  The Contact Sample Application
    Synchronization

Synchronizing products in the Contact sample


The scripts for the Product table illustrate conflict detection and resolution.

The Product table is kept in a separate publication from the other tables so that it can be downloaded separately. For example, if the price changes and the sales representative is synchronizing over a slow link, they can download the product changes without uploading their own customer and contact changes.

Business rules 

The only change that can be made at the remote database is to change the quantity column, when an order is taken.

Downloads 
Uploads 

Only UPDATE operations are uploaded from the remote database. The major feature of these upload scripts is a conflict detection and resolution procedure.

If two sales representatives take orders and then synchronize, each order is subtracted from the quantity column of the Product table. For example, if Sam Singer takes an order for 20 baseball hats (product ID 400), he will change the quantity from 90 to 70. If Pam Savarino takes an order for 10 baseball hats before receiving this change, she will change the column in her database from 90 to 80.

When Sam Singer synchronizes his changes, the quantity column in the consolidated database is changed from 90 to 70. When Pam Savarino synchronizes her changes, the correct action is to set the value to 60. This setting is accomplished by detecting the conflict.

The conflict detection scheme includes the following scripts:

Conflict resolution 

Contents Index Synchronizing contacts in the Contact sample Monitoring statistics and errors in the Contact sample