IDimAttributeInstance.LookupValue

Syntax

LookupValue(Value: Variant): Integer;

Parameters

Value - attribute value to be found.

Description

The LookupValue method searches for attribute value and returns element index if the search is successful.

Comments

This method returns the first found element that has selected attribute value. The method returns -1 if the specified attribute value could not be found. The value specified in the Value parameter is case-sensitive. Only full value is searched for.

In MDM dictionaries attributes used to establish links, may have mismatching attribute value type and type of displayed attribute value. Use the LookupDisplayValue method to search by displayed attribute value.

Example

Executing the example requires that the repository contains a dictionary with the D_TO identifier.

Sub UserProc;
Var
    MB: IMetabase;
    Dimen: IDimInstance;
    Attrs: IDimAttributesInstance;
    Attr: IDimAttributeInstance;
    i: Integer;
Begin
    MB := MetabaseClass.Active;
    Dimen := MB.ItemById("D_TO").Open(NullAs IDimInstance;
    Attrs := Dimen.Attributes;
    Attr := Attrs.FindById("NAME");
    If Attr <> Null Then
        i := Attr.LookupValue("Russian Federation");
    End If;
End Sub UserProc;

After executing the example the search is carried out by selected dictionary attribute. If the search is successful, the "i" variable contains index of the found element.

See also:

IDimAttributeInstance