IRdsMergeCallback.OnBeforeProcess

Syntax

OnBeforeProcess(Var bCancel: Boolean);

Parameters

bCancel. Parameter that determines whether further elements synchronization is executed.

Description

The OnBeforeProcess method implements an event that occurs after comparing elements and before synchronization of elements that have different attributes values.

Comments

Available values of the bCancel parameter:

Example

Executing the example requires an MDM repository with the NSI_1 identifier. Data of synchronized dictionaries is stored in the Sinc.rpl file.

Add links to the Db, Metabase, Rds system assemblies.

Public Class MyCallback: Object, IRdsMergeCallback
    
    
Public Sub OnProgress(Progress: Integer; Total: Integer);
    
Begin
        Debug.WriteLine(
"Done: " + Progress.ToString + " from " + Total.ToString);
    
End Sub OnProgress;
    
    
Public Sub OnConflict(LoadElement: IRdsDictionaryElement; CurrentElement: IRdsDictionaryElement);
    
Begin
        Debug.Write(
"The element has different values: ");
        Debug.Write(LoadElement.Name);
        Debug.Write(
" | ");
        Debug.WriteLine(CurrentElement.Name);
    
End Sub OnConflict;
    
    
Public Sub OnBeforeProcess(Var bCancel: Boolean);
    
Begin
        bCancel := 
False;
    
End Sub OnBeforeProcess;
    
    
Public Sub OnConflictResolve(LoadElement: Integer; CurrentElement: Integer; Var Ignor: Boolean);
    
Begin
        Ignor := 
True;
End Sub OnConflictResolve;

End Class MyCallback;

Sub Main;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    NSI: IRdsDatabase;
    NSIInst: IRdsDatabaseInstance;
    Trans: IConnectionTransaction;
    CallBack: MyCallback;
    Replic: IRdsReplicator;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemById(
"NSI_1").Bind;
    NSI := MObj 
As IRdsDatabase;
    NSIInst := NSI.Open(
Null);
    Trans := NSIInst.DatabaseInstance.Connection.StartTransaction(
False);
    CallBack := 
New MyCallback.Create;
    Replic := NSIInst.CreateReplicator;
    Replic.LoadFromFile(
"c:\Sinc.rpl");
    Replic.Merge(CallBack);
    Trans.Commit;
End Sub Main;

After executing the example dictionaries are synchronized in the NSI_1 MDM repository. The MyCallback custom class is used to control synchronization process. During the execution, common status of a process and also elements names with different values in a dictionary and loaded file are displayed in the console.

See also:

IRdsMergeCallback