MoveTo(FromIndex: Integer; ToIndex: Integer);
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.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Laner;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
WbkObj: IMetabaseObject;
EaxAn: IEaxAnalyzer;
Laner: ILaner;
CommentAttr: ILanerCellAttributes;
Begin
// Get workbook
mb := Params.Metabase;
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;
See also: