LookUpFirst: Integer;
The LookUpFirst method searches for the first element meeting certain condition and returns element index if the search is successful. The method returns -1 if no elements could be found.
Executing the example requires that the repository contains a dictionary with the Dim_1 identifier. The first dictionary index is created based on two dictionary attributes.
Sub Main;
Var
MB: IMetabase;
Dimen: IDimInstance;
IndxsInst: IDimIndexesInstance;
IndexInst: IDimIndexInstance;
InstLook: IDimIndexInstanceLookup;
i: Integer;
Begin
MB := MetabaseClass.Active;
Dimen := MB.ItemById("Dim_1").Open(Null) As IDimInstance;
IndxsInst := Dimen.Indexes;
If IndxsInst.Count <> 0 Then
IndexInst := IndxsInst.Item(0);
InstLook := IndexInst.CreateDimIndexLookup;
InstLook.AttributeValue(0) := 10;
InstLook.AttributeValue(1) := 100;
i := InstLook.LookUpFirst;
End If;
End Sub Main;
After executing the example the search is carried out by values of attributes of the first dictionary index. If the search is successful, the "i" variable contains the number of the found element.
See also: