FindByKey(AttributeKey: Integer): IDimAttribute;
AttributeKey. Key of the attribute, by which the search is executed.
The FindByKey method finds attribute in the index by its key.
If an attribute with the specified key is not included into index, the method returns Null.
Executing the example requires that the repository contains a table dictionary with the D_TO identifier.
Add links to the Dimensions, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
DimModel: IDimensionModel;
Index: IDimIndex;
IndAtr: IDimIndexAttributes;
Atr: IDimAttribute;
Begin
// Get current repository
MB := MetabaseClass.Active;
// Get dictionary
DimModel := MB.ItemById("D_TO").Bind As IDimensionModel;
// Get the first dictionary index
Index := DimModel.Indexes.Item(0);
If Index <> Null Then
// Get attributes of the first dictionary index
IndAtr := Index.Attributes;
// Search for attribute by key
Atr := IndAtr.FindByKey(2);
If Atr <> Null Then
Debug.WriteLine("Found attribute name: " + Atr.Name);
Else
Debug.WriteLine("Attribute is not found");
End If;
End If;
End Sub
After executing the example the attribute with the 2 key is searched in the dictionary first index. If the attribute is found, its name is displayed in the console window.
See also: