Element: Integer;
The Element property returns index of dictionary element at which the iterator cursor is positioned.
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.Element;
End Sub Main;
Executing the example creates an iterator based on the array of elements named ElemArr. The cursor is positioned over a random element, and the "i" variable shows index of the dictionary element corresponding to the number of iterator element.
See also: