Position: Integer;
The Position property returns cursor position in the iterator.
Sub Main;
Var
MB: IMetabase;
Dimen: IDimInstance;
Elem: IDimElements;
ElemArr: IDimElementArray;
Iter: IDimIterator;
i: Integer;
Begin
MB:=MetabaseClass.Active;
Dimen:=MB.ItemById("D_TO").Open(Null) As IDimInstance;
Elem:=Dimen.Elements;
ElemArr:=Elem.Children(10);
Iter:=ElemArr.Iterator;
For i:=0 To Math.RandBetweenI(0,Iter.DimElementArray.Count) Do
Iter.Next;
End For;
i:=Iter.Position;
End Sub Main;
Executing the example creates an iterator based on the array of elements named ElemArr. Iterator's cursor is set at a random element, and the "i" variable contains the number of this element.
See also: