FindByKey(AttributeKey: Integer): IStandardDimIndexAttribute;
AttributeKey. Attribute key used for search.
The FindByKey method searches dictionary attribute by which the index is created. Search is executed by the key passed by the AttributeKey parameter.
Sub UserProc;
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 UserProc;
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: