FindByKey(AttributeKey: Integer): ICalendarDimAttribute;
AttributeKey. Key of the attribute on which the search is based.
The FindByKey method searches the custom attribute, key of which is passed in the AttributeKey parameter.
Sub Main;
Var
MB: IMetabase;
CalDim: ICalendarDimension;
UserAttrs: ICalendarDimAttributes;
UserAttr: ICalendarDimAttribute;
s: String;
Begin
MB := MetabaseClass.Active;
CalDim := MB.ItemById("CALENDAR_DIM").Bind As ICalendarDimension;
UserAttrs := CalDim.Attributes;
UserAttr := UserAttrs.FindByKey(14475);
If UserAttr <> Null Then
s := UserAttr.Name;
Else
s := "Attribute not found";
End If;
End Sub Main;
After executing the example a custom attribute with the 14475 key is searched, and if the element is found, the "s" variable contains its name.
See also: