IMbElementDependents.Remove

Fore Syntax

Remove(Index: Integer): Boolean;

Fore.NET 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.

Fore 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.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Rds;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Obj, Dictionary: IMetabaseObjectDescriptor;
    RdsDictIns: IRdsDictionaryInstance; 
    Elements: IRdsDictionaryElements;
    Depends: IMbElementDependents;
    DependTemplClassT, DependTemplClassV: MbElementDependentTemplateClassClass = New MbElementDependentTemplateClassClass();
    Template, Value: MbElementDependentTemplateClass;
    ElemKeys: Array[2Of uinteger;
    ObjKey, DictKey, ElemKey: uinteger;
    ElemDependDB: IMbElementDependentsDatabase;
Begin
    MB := Params.Metabase;
    Obj := MB.ItemById["DICT1"];
    Dictionary := MB.ItemById["DICT"];
    RdsDictIns := Dictionary.Open(NullAs IRdsDictionaryInstance;
    Elements := RdsDictIns.Elements;
    // Object settings:
    Obj := Obj.EditDescriptor();
    Obj.ElementDependenciesTrackingType := MbElementDependenciesTrackingType.mbeledeptratypDependecies;
    Obj.ElementDependents;
    Obj.SaveDescriptor();
    /// Settings:
    DictKey := Dictionary.Key;
    ObjKey := Obj.Key;
    // Template:
    DependTemplClassT.CreateByDictionary(DictKey);
    Template := DependTemplClassT As MbElementDependentTemplateClass;
    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);
    DependTemplClassV.Create(ObjKey, DictKey, ElemKey);
    Value := DependTemplClassV As MbElementDependentTemplateClass;
    Depends.Add(Value);
    Depends.Remove(0);
    ElemDependDB.Update(Depends);
End Sub;

See also:

IMbElementDependents