MoveTo(FromIndex: Integer; ToIndex: Integer);
FromIndex. Index of the position of the model that should be moved.
ToIndex. Index of the position to which the model should be moved.
The MoveTo method moves a model within the collection.
Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier. This container should include a system of non-linear equations with the NON_LINEAR_MODEL identifier containing external conditions.
Sub Main;
Var
mb: IMetabase;
ModelCont: IMetabaseObjectDescriptor;
Model: IMsModel;
Trans: IMsFormulaTransform;
Formula: IMsFormula;
Equations: IMsNonLinearEquationsTransform;
Descript: IMetabaseObjectDescriptor;
ExternalEquations: IMsModelList;
i: Integer;
Begin
mb := MetabaseClass.Active;
ModelCont := mb.ItemById("CONT_MODEL");
Descript := mb.ItemByIdNamespace("NON_LINEAR_MODEL", ModelCont.Key);
Model := Descript.Edit As IMsModel;
Trans := Model.Transform;
Formula := Trans.EquationsFormula;
Equations := Formula.Method As IMsNonLinearEquationsTransform;
ExternalEquations := Equations.ExternalEquations;
i := ExternalEquations.Count;
ExternalEquations.MoveTo(0, i - 1);
(Model As IMetabaseObject).Save;
End Sub Main;
After executing the example the first external equation is swapped with the last one in the system of non-linear equations.
See also: