IMbElementDependents.Remove

Syntax

Remove(Index: Integer): Boolean;

Parameters

Index. Index of record of dependencies of MDM dictionary elements from repository objects.

Description

The Remove method removes dependency record of MDM dictionary elements from repository objects by its index.

Comments

The method returns True if removal is successful.

To remove all dependency records of MDM dictionary elements from repository objects by its index, use the IMbElementDependents.Clear method.

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: IMetabaseObjectDescriptor;
    RdsDictIns: IRdsDictionaryInstance; 
    Elements: IRdsDictionaryElements;
    Depends: IMbElementDependents;
    Template, Value: IMbElementDependentTemplate;
    ElemKeys: Array[2Of Integer;
    ObjKey, DictKey, ElemKey: Integer;
    ElemDependDB: IMbElementDependentsDatabase;
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.Remove(0);
    ElemDependDB.Update(Depends);
End Sub UserProc;

After executing the example the first dependency record of MDM dictionary elements from repository objects.

See also:

IMbElementDependents