Synchronization Overview

The Sync commands provide more control over how often the data in a table is synchronized with other databases. The synchronization runs as a background process and is designed to synchronize records where a change occurred. The process includes changes was not captured in the prior synchronization process.

The default server for client synchronization defaults to the server defined in the client profile. If you want to use a different server, use Sync.SetHost.

The Sync commands available are:

SetHost

SyncNow

SyncSetTabelFilter

SyncStart

SyncStop

Instead of running continuously, the Sync.SyncStart process can be set to run after a specified period of time. For example if it takes 5 minutes for your device to synchronize, and you set the elaspe time of 1 minute, then the synchronization process will kick-off every 6 minutes.

If you need the synchronization background process to stop, use the Sync.SyncStop( )command.

If you set a command to stop the synchronization process, after it was initiated, the system will stop gracefully. (It will compete the process it committed to instead of stopping abruptly.)

If you want the process to synchronize immediately instead of waiting for its preset cycle, you can use the SyncNow command. This works in two ways. For example, if you have an offline solution and don't have a sync process running in the background, but need the table data synchronized when the user taps a button, the sync.now process will launch the Sync process, but only once. However, if the synch process running in the background, and is just waiting for its next start time, then the SyncNow command will wake up the process and make it start immediately. The SyncNow completes its synchronization then terminates. The background process executed from Sync.Start will resume its course once SyncNow terminates.

SyncNow Technical Details

If the thread is running but its actually waiting for its start time or interval, the Sync.Now( ) will make the thread go immediately. If that thread is not running, then it will start running, but will only make one pass. After it completes that pass, the Sync.Now process will come back and terminate itself.

There is also a Sync.CommandTimout command you can use to specify how long the sync process will wait for the host to respond/complete a download. For example, you don't want to take more than 5 minutes to download a table and you know you have a million records to download or the device is not getting a response from the server.

The command timeout will adjust how long it keeps going before it gives up.

The timeout is set in seconds.

Using filters to specify what is synchronized

Sync.SetTableFilter - This adds a Where clause to the SQL query used to synchronize the offline data. This helps narrow the scope of synchronization actions so that they are very specific to what you want to synchronize. There are no "rules" on how to use so that your usage is flexible. For example, if your customer has 3 locations where an offline client will be used to collect data, you use this command to build a filter that would only synchronize data updates for the end user's specific location.

 

Supported Versions:     RFgen 5.2.5.6 and newer. RFgen 6.0 and newer.