IMsFormulaTermList.MoveTo

Syntax

MoveTo(FromIndex: Integer; ToIndex: Integer);

Parameters

FromIndex. The position index of the term that must be moved.

ToIndex. Index of the position, where the term must be moved.

Description

The MoveTo method moves a term within the collection.

Example

Executing the example requires that the repository contains a modeling container with the TRANSFORMATION identifier. This container should include a standard model with the M_SPLICE identifier that splices several series.

Add links to the Metabase and Ms system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    ModelCont: IMetabaseObjectDescriptor;
    Descript: IMetabaseObjectDescriptor;
    Obj: IMetabaseObject;
    Model: IMsModel;
    Transform: IMsFormulaTransform;
    TransformVar: IMsFormulaTransformVariable;
    Slice: IMsFormulaTransformSlice;
    Operands: IMsFormulaTermList;
    Selector: IMsFormulaTransformSelector;
    Formula: IMsFormula;
    Splice: IMsSpliceTransform;
    i: Integer;
Begin
    mb := MetabaseClass.Active;
    ModelCont := mb.ItemById("TRANSFORMATION");
    Descript := mb.ItemByIdNamespace("M_SPLICE",ModelCont.Key);
    Obj := Descript.Edit;
    Model := Obj As IMsModel;
    Transform := Model.Transform;
    TransformVar := Transform.Outputs.Item(0);
    Slice := TransformVar.Slices.Add(Null);
    Selector := Transform.CreateSelector;
    Selector.Slice := Slice;
    Formula := Transform.Transform(Selector);
    Splice := Formula.Method As IMsSpliceTransform;
    Operands := Splice.Operands;
    i := Operands.Count -1;
    Operands.MoveTo(0, i);
    Obj.Save;
End Sub UserProc;

After executing the example the first and the last series in the collection of spliced series are swapped.

See also:

IMsFormulaTermList