FindByKey(AttributeKey: Integer): IStandardDimIndexAttribute;
AttributeKey - key of the attribute, on which the search is based.
The FindByKey method searches dictionary attribute by which the index is created. The search is carried out by the key passed by the AttributeKey parameter.
Sub Main;
Var
MB: IMetabase;
Dim: IStandardDimension;
DimInds: IStandardDimIndexes;
DimIndex: IStandardDimIndex;
DimIndAttrs: IStandardDimIndexAttributes;
DimIndAttr: IStandardDimIndexAttribute;
s: String;
Begin
MB:=MetabaseClass.Active;
Dim:=MB.ItemById("TAB_DIM").Bind As IStandardDimension;
DimInds:=Dim.Indexes;
If DimInds.Count<>0 Then
DimIndex:=DimInds.Item(0);
DimIndAttrs:=DimIndex.Attributes;
DimIndAttr:=DimIndAttrs.FindByKey(Dim.Attributes.Name.Key);
If DimIndAttr<>Null Then
s:=DimIndAttr.Id;
Else
s:="It is not found";
End If;
End If;
End Sub Main;
After executing the example the method searches for the attribute functioning as Name by the first dictionary index. If the attribute is found, the "s" variable shows its name. Table dictionary identifier: TAB_DIM.
See also: