IMbElementDependent.Dictionary

Fore Syntax

Dictionary: IMetabaseObjectDescriptor;

Fore.NET Syntax

Dictionary: Prognoz.Platform.Interop.Metabase.IMetabaseObjectDescriptor;

Description

The Dictionary property returns an MDM dictionary, which elements depend on repository object.

Comments

To get the object of repository, on which MDM dictionary object depends, use the IMbElementDependent.Object property.

Fore Example

Executing the example requires MDM dictionaries with the DICT and DICT1 identifiers.

Add links to the Metabase, Rds system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Obj, Dictionary, Dict: IMetabaseObjectDescriptor;
    RdsDictIns: IRdsDictionaryInstance; 
    Elements: IRdsDictionaryElements;
    Depends: IMbElementDependents;
    Depend: IMbElementDependent;
    Template, Value: IMbElementDependentTemplate;
    ElemKeys: Array[2Of Integer;
    ObjKey, DictKey, ElemKey: Integer;
    ElemDependDB: IMbElementDependentsDatabase;
    i: Integer;
Begin
    MB := MetabaseClass.Active;
    Obj := MB.ItemById("DICT1");
    Dictionary := MB.ItemById("DICT");
    RdsDictIns := Dictionary.Open(NullAs IRdsDictionaryInstance;
    Elements := RdsDictIns.Elements;
    // Object settings:
    Obj := Obj.EditDescriptor;
    Obj.ElementDependenciesTrackingType := MbElementDependenciesTrackingType.Dependecies;
    Obj.ElementDependents;
    Obj.SaveDescriptor;
    /// Settings:
    DictKey := Dictionary.Key;
    ObjKey := Obj.Key;
    // Template:
    Template := New MbElementDependentTemplateClass.CreateByDictionary(DictKey);
    Template.DictionaryKey := Dictionary.Key;
    ElemKeys[0] := Elements.Element(1);
    ElemKeys[1] := Elements.Element(2);
    //Specify keys of elements
    Template.ElementKeys := ElemKeys;
    // Collection of dependencies:
    ElemDependDB := Mb.ElementDependentsDatabase;
    Depends := ElemDependDB.Select_(Template);
    Value := New MbElementDependentTemplateClass.Create(ObjKey, DictKey, ElemKey);
    Depends.Add(Value);
    Depends.Modified := True;
    ElemDependDB.Update(Depends);
    // Output information:
    Debug.WriteLine("Current repository parameters: " + ElemDependDB.Metabase.Name);
    If ElemDependDB.Active = True Then
            Debug.WriteLine("Dependencies can be saved for repository objects");
        Else
            Debug.WriteLine("Dependencies cannot be saved for repository objects");
    End If;
    Debug.WriteLine("Object dependencies are set up:");
    For i := 0 To Depends.Count - 1 Do
        Depend := Depends.Item(i);
        Dict := Depend.Dictionary;
        Debug.WriteLine("    " + Dict.Name + ", identifier: " + Dict.Id);
        Obj := Depend.Object;
        Debug.WriteLine("    " + Obj.Name + ", identifier: " + Obj.Id);
    End For;
    Debug.WriteLine("Number of element keys of MDM dictionary: "
        + Template.ElementKeysCount.ToString);
End Sub UserProc;

After executing the example the information is displayed to the console window:

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Rds;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Obj, Dictionary, Dict: IMetabaseObjectDescriptor;
    RdsDictIns: IRdsDictionaryInstance; 
    Elements: IRdsDictionaryElements;
    Depends: IMbElementDependents;
    Depend: IMbElementDependent;
    Template, Value: MbElementDependentTemplateClass;
    DependTemplClassT, DependTemplClassV: MbElementDependentTemplateClassClass = New MbElementDependentTemplateClassClass();
    ElemKeys: Array[2Of uinteger;
    ObjKey, DictKey, ElemKey: uinteger;
    ElemDependDB: IMbElementDependentsDatabase;
    i: Integer;
Begin
    MB := Params.Metabase;
    Obj := MB.ItemById["DICT1"];
    Dictionary := MB.ItemById["DICT"];
    RdsDictIns := Dictionary.Open(NullAs IRdsDictionaryInstance;
    Elements := RdsDictIns.Elements;
    // Object settings:
    Obj := Obj.EditDescriptor();
    Obj.ElementDependenciesTrackingType := MbElementDependenciesTrackingType.mbeledeptratypDependecies;
    Obj.ElementDependents;
    Obj.SaveDescriptor();
    /// Settings:
    DictKey := Dictionary.Key;
    ObjKey := Obj.Key;
    // Template:
    DependTemplClassT.CreateByDictionary(DictKey);
    Template := DependTemplClassT As MbElementDependentTemplateClass;
    Template.DictionaryKey := Dictionary.Key;
    ElemKeys[0] := Elements.Element[1];
    ElemKeys[1] := Elements.Element[2];
    //Specify keys of elements
    Template.ElementKeys := ElemKeys;
    // Collection of dependencies:
    ElemDependDB := Mb.ElementDependentsDatabase;
    Depends := ElemDependDB.@Select(Template);
    DependTemplClassV.Create(ObjKey, DictKey, ElemKey);
    Value := DependTemplClassV As MbElementDependentTemplateClass;
    Depends.Add(Value);
    Depends.Modified := True;
    ElemDependDB.Update(Depends);
    // Output information:
    System.Diagnostics.Debug.WriteLine("Current repository parameters: " + ElemDependDB.Metabase.Name);
    If ElemDependDB.Active = True Then
            System.Diagnostics.Debug.WriteLine("Dependencies can be saved for repository objects");
        Else
            System.Diagnostics.Debug.WriteLine("Dependencies cannot be saved for repository objects");
    End If;
    System.Diagnostics.Debug.WriteLine("Dependencies are set up for objects:");
    For i := 0 To Depends.Count - 1 Do
        Depend := Depends.Item[i];
        Dict := Depend.Dictionary;
        System.Diagnostics.Debug.WriteLine("    " + Dict.Name + ", identifier: " + Dict.Id);
        Obj := Depend.Object;
        System.Diagnostics.Debug.WriteLine("    " + Obj.Name + ", identifier: " + Obj.Id);
    End For;
    System.Diagnostics.Debug.WriteLine("Number of element keys of MDM dictionary: "
        + Template.ElementKeysCount.ToString());
End Sub;

See also:

IMbElementDependent