MoveTo(FromIndex: Integer; ToIndex: Integer);
FromIndex. Index of attribute start position.
ToIndex. Index of the position, into which the attribute should be shifted.
The MoveTo method moves the specified attribute to the required position.
Indexation of attributes in the collection starts with zero. To get the number of collection attributes, use the ILanerCellAttributes.Count property.
Executing the example requires the repository contains a workbook with the WORKBOOK_CMT identifier that contains several series. It is also required to set several attributes used to form comments for series observations.
Add links to the Express, Laner and Metabase system assemblies.
Sub UserProc;
Var
mb: IMetabase;
WbkObj: IMetabaseObject;
EaxAn: IEaxAnalyzer;
Laner: ILaner;
CommentAttr: ILanerCellAttributes;
Begin
// Get workbook
mb := MetabaseClass.Active;
WbkObj := mb.ItemById("WORKBOOK_CMT").Edit;
EaxAn := WbkObj As IEaxAnalyzer;
Laner := EaxAn.Laner;
// Get collection of comment attributes
CommentAttr := Laner.CommentAttributes;
// If there are more than two attributes in the collection, swap them
If CommentAttr.Count >= 2 Then
CommentAttr.Move(0, 1);
End If;
// Save changes
WbkObj.Save;
End Sub UserProc;
After executing the example the first and the second attribute are swapped in the collection.
See also: