IRdsReplicator.Dictionaries

Syntax

Dictionaries: IRdsDictionarySet;

Description

The Dictionaries property returns a collection of dictionaries, which data should be synchronized.

Example

Executing the example requires the MDM repository with the NSI_1 identifier. Add links to the Metabase, Rds system assemblies.

Function CreateList(Parent: Integer; DictSet: IRdsDictionarySet; MB: IMetabase): IRdsDictionarySet;
Var
    MObj: IMetabaseObjectDescriptor;
    MObjChilds: IMetabaseObjectDescriptors;
    MObjChildDesct: IMetabaseObjectDescriptor;
    MObjChild: IMetabaseObject;
    Dict: IRdsDictionary;
    i: Integer;
Begin
    MObj := MB.Item(Parent);
    MObjChilds := MObj.Children;
    For i := 0 To MObjChilds.Count - 1 Do
        MObjChildDesct := MObjChilds.Item(i);
        // If the dictionary is a composite MDM dictionary
        MObjChild := MObjChildDesct.Bind;
        If MObjChild Is IRdsDictionary Then
            Dict := MObjChild As IRdsDictionary;
            If Dict.Distributed Then
                DictSet.Add(Dict);
            End If;
            // If  the object is a folder in the MDM dictionary
        Elseif MObjChild Is IFolder Then
            CreateList(MObjChild.Key, DictSet, MB);
        End If;
    End For;
    Return DictSet;
End Function CreateList;

Sub UserPr;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    NSI: IRdsDatabase;
    NSIInst: IRdsDatabaseInstance;
    Replic: IRdsReplicator;
    DictSet: IRdsDictionarySet;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemById("NSI_1").Bind;
    NSI := MObj As IRdsDatabase;
    NSIInst := NSI.Open(Null);
    Replic := NSIInst.CreateReplicator;
    DictSet := Replic.Dictionaries;
    DictSet := CreateList(MObj.Key, DictSet, MB);
    Replic.SaveToFile("C:\Sinc.rpl");
End Sub UserPr;

After executing the UserPr procedure, all the dictionaries in the MDM repository are recursively viewed. Dictionaries that contain unique elements identifier are added in a synchronization list. Data from all the dictionaries included in the list is saved to the C:\Sinc.rpl file.

See also:

IRdsReplicator