TrackElementDependencies: Boolean;
The TrackElementDependencies property indicates whether the object dependencies on the MDM dictionary elements are tracked.
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.
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(Null) As 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;
After executing the 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. The list of dependencies will be saved in the repository database.
See also: