ElementDependencies: IMbElementDependencies;
ElementDependencies: Prognoz.Platform.Interop.Metabase.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 an object of a custom class with the OBJ_CUSTOM identifier and an MDM dictionary with the Country identifier. The dictionary is stored in the MDM repository with the RDS 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.ItemByIdNamespace("Country", MB.ItemById("RDS").Key);
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 this 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. A list of dependencies is saved in the repository base.
See also: