IMetabaseObjectDescriptor.TrackElementDependencies

Syntax

TrackElementDependencies: Boolean;

TrackElementDependencies: boolean;

Description

The TrackElementDependencies property indicates whether the object dependencies on the MDM dictionary elements are tracked.

Comments

If the property is set to True, dependency on the elements of the MDM dictionaries are tracked for the object. Information about dependencies can be obtained in the IMetabaseObjectDescriptor.ElementDependencies property.

If this property is changed, the IMetabaseObjectDescriptor.ElementDependenciesTrackingType property is changed automatically.

Example

Executing the example requires that the repository contains an object with the Obj_1 identifier and an MDM dictionary with the Country identifier in repository. The object supports tracking of dependencies on the elements of dictionaries.

Add links to the Metabase, Rds system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Obj, Dictionary: IMetabaseObjectDescriptor;
    Elements: IRdsDictionaryElements;
    Depends: IMbElementDependencies;
    Template: IMbElementDependencyTemplate;
Begin
    MB := MetabaseClass.Active;
    Obj := MB.ItemById(
"Obj_1");
    Dictionary := MB.ItemById(
"Country");
    Elements := (Dictionary.Open(
NullAs IRdsDictionaryInstance).Elements;
    
//Change settings to use tracking of dependencies
    Obj := Obj.EditDescriptor;
    Obj.TrackElementDependencies := 
True;
    Obj.SaveDescriptor;
    
//Change settings to use tracking of references to elements of the dictionary
    Dictionary := Dictionary.EditDescriptor;
    Dictionary.TrackElementDependents := 
True;
    Dictionary.SaveDescriptor;
    
//New template for adding the dependency
    //A pattern is created for the first element of MDM dictionary
    Template := New MbElementDependencyTemplateClass.Create(Obj.Key, Dictionary.Key, Elements.Element(1));
    
//Collection of object dependencies
    Depends := Obj.ElementDependencies;
    Depends.Add(Template);
    Mb.ElementDependenciesDatabase.Update(Depends);
End Sub UserProc;
Imports Prognoz.Platform.Interop.Rds;
 
Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Obj, Dictionary: IMetabaseObjectDescriptor;
    Elements: IRdsDictionaryElements;
    Depends: IMbElementDependencies;
    Template: MbElementDependencyTemplateClass;
Begin
    MB := Params.Metabase;
    Obj := MB.ItemById[
"Obj_1"];
    Dictionary := MB.ItemById[
"Country"];
    Elements := (Dictionary.Open(
NullAs IRdsDictionaryInstance).Elements;
    
//Change settings to use tracking of dependencies
    Obj := Obj.EditDescriptor();
    Obj.TrackElementDependencies := 
True;
    Obj.SaveDescriptor();
    
//Change settings to use tracking of references to elements of the dictionary
    Dictionary := Dictionary.EditDescriptor();
    Dictionary.TrackElementDependents := 
True;
    Dictionary.SaveDescriptor();
    
//New template for adding the dependency
    //A pattern is created for the first element of MDM dictionary
    Template := New MbElementDependencyTemplateClassClass.Create();
    Template.Create(Obj.Key, Dictionary.Key, Elements.Element[
1As integer);
    
//Collection of object dependencies
    Depends := Obj.ElementDependencies;
    Depends.Add(Template);
    Mb.ElementDependenciesDatabase.Update(Depends);
End Sub;

After executing this example the function of tracking of the dependencies on the elements of the dictionary is activated for the specified object and for the MDM dictionary. A new dependency from the first element of a dictionary will be created for an object. A list of dependencies is saved in the repository base.

See also:

IMetabaseObjectDescriptor