PopulatePartial Method (JRO)

Jet Replication Objects

PopulatePartial Method

       

Populates a partial replica.

Syntax

Replica.PopulatePartial(FullReplica)

Parameters

FullReplica   A String value representing the path and file name of the replica to populate with data.

Remarks

When you synchronize a partial replica with a full replica, it is possible to create "orphaned" records in the partial replica. For example, suppose you have a Filter for the Customers table with a FilterCriteria of "Region = 'CA'". If a user changes a customer's region from CA to NY in the partial replica, and then a synchronization occurs with the Synchronize method, the change is propagated to the full replica. But the record containing NY in the partial replica is orphaned because it now doesn't meet the replica filter criteria.

To solve the problem of orphaned records, you can use the PopulatePartial method. The PopulatePartial method is similar to the Synchronize method, but it synchronizes any changes in the partial replica with the full replica, removes all records in the partial replica, and then repopulates the partial replica based on the current replica filters. Even if your replica filters have not changed, PopulatePartial will always clear all records in the partial replica and repopulate it based on the current filters.

Generally, you should use the PopulatePartial method when you create a partial replica and whenever you change your replica filters. If your application changes replica filters, you should follow these steps:

  1. Synchronize the full replica with the partial replica in which the filters are being changed.

  2. Use the Filter object to make the desired changes to the replica filter.

  3. Call the PopulatePartial method to remove all records from the partial replica and transfer all records from the full replica that meet the new replica filter criteria.

If a replica filter has changed, and the Synchronize method is called without first calling PopulatePartial, a trappable error occurs.

The PopulatePartial method can only be invoked on a partial replica that has been opened for exclusive access. Furthermore, you can not call the PopulatePartial method from code running within the partial replica itself. Instead, open the partial replica exclusively from the full replica or another database, then call PopulatePartial.

Note   Although PopulatePartial performs a one-way synchronization before clearing and repopulating the partial replica, it is still a good idea to call Synchronize before calling PopulatePartial. When using the direct or Internet synchronization modes, if the call to Synchronize fails, a trappable error occurs. You can use this error to decide whether or not to proceed with the PopulatePartial method (which removes all records in the partial replica). For indirect synchronization, a trappable error does not occur; see the Synchronize method for more information. If PopulatePartial is called by itself and an error occurs while records are being synchronized, records in the partial replica will still be cleared, which may not be the desired result.

This method can only be used if the database is replicable and it uses a PartialReplica. An error will occur if the ReplicaType is jrRepTypeNotReplicable and the user attempts to use this method.