ElementDependencies: IMbElementDependencies;
The ElementDependencies property determines a collection of the dependencies of the user class object on the elements of the MDM dictionary.
Executing the example requires that the repository contains a custom class object with the OBJ_CUSTOM identifier and an MDM dictionary with the Country identifier.
Sub UserProc;
Var
Mb: IMetabase;
Object: IMetabaseObjectDescriptor;
CustomObject: IMetabaseCustomObject;
Writer: IMetabaseCustomObjectWriter;
Depends: IMbElementDependencies;
Dictionary: IMetabaseObjectDescriptor;
Elements: IRdsDictionaryElements;
Template: IMbElementDependencyTemplate;
Begin
Mb := MetabaseClass.Active;
Object := Mb.ItemById("OBJ_CUSTOM");
Object := Object.EditDescriptor;
Object.TrackElementDependencies := True;
Object.SaveDescriptor;
CustomObject := Object.Edit As IMetabaseCustomObject;
Writer := CustomObject.CreateWriter;
Dictionary := MB.ItemById("Country");
Elements := (Dictionary.Open(Null) As IRdsDictionaryInstance).Elements;
Depends := Writer.NewElementDependencies;
Template := New MbElementDependencyTemplateClass.CreateByElement(
Dictionary.Key, Elements.Element(1));
Depends.Add(Template);
Writer.ElementDependencies := Depends;
Writer.Save;
Mb.ElementDependenciesDatabase.Update(Depends);
End Sub UserProc;
After executing the example a function of monitoring dependencies from dictionary elements is switched for a specified object. 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: