MoveToParent(Parent: IMsCalculationChainEntries; Index: Integer);
Parent. The parent collection of elements where it is necessary to replace the element.
Index.Position, to which the element must be moved.
The MoveToParent method moves metamodel calculation chain element.
Executing the example requires that the repository contains a modeling container with the OBJ_CONT identifier. This container must include a metamodel with the OBJ_META identifier.
Sub Main;
Var
Mb: IMetabase;
ContKey: Integer;
MModel: IMsMetaModel;
Parent: IMsCalculationChainEntries;
ChainEntry: IMsCalculationChainEntry;
Begin
Mb := MetabaseClass.Active;
ContKey := Mb.GetObjectKeyById("OBJ_CONT");
MModel := Mb.ItemByIdNamespace("OBJ_META", ContKey).Edit As IMsMetaModel;
Parent := MModel.CalculationChain;
ChainEntry := Parent.Item(Parent.Count - 1);
ChainEntry.MoveToParent(Parent, 0);
(MModel As IMetabaseObject).Save;
End Sub Main;
After executing the example the last element in calculation chain of metamodel is moved to initial position.
See also: