IMsMetaAttributeValueList.FindByKey

Syntax

FindByKey(AttributeKey: String): IMsMetaAttributeValue;

Parameters

AttributeKey. The attribute key, based on which the search is performed.

Description

The FindByKey method searches for an attribute in the collection based on the specified key. The key, based on which the search is performed, is passed by the AttributeKey parameter.

Example

Executing the example requires that the repository contains a time series database with the OBJ_FC identifier. This database must contain validation filter with the OBJ_VALID_FILTER identifier. COUNTRY is a custom attribute of the time series database that refers to the dictionary.

Sub UserProc;
Var
    Mb: IMetabase;
    RubrKey: Integer;
    ValidObj: IMetabaseObject;
    ValidFilter: IValidationFilter;
    Trend: IValidationTrend;
    ValidExecSett: IValidationExecuteSettings;
    ValidExecRun: IValidationExecRun;
    MetaAttrValList: IMsMetaAttributeValueList;
    MetaAttrFilter: IMsMetaAttributeFilter;
    Rub: IRubricator;
    MetaAttr: IMetaAttribute;
    MetaAttrVal: IMsMetaAttributeValue;
Begin
    Mb := MetabaseClass.Active;
    RubrKey := Mb.GetObjectKeyById("OBJ_FC");
    ValidObj := Mb.ItemByIdNamespace("OBJ_VALID_FILTER", RubrKey).Edit;
    ValidFilter := ValidObj As IValidationFilter;
    ValidFilter.Level := DimCalendarLevel.None;
    ValidFilter.Kind := ValidationDetailsKind.Trend;
    Trend := ValidFilter.Details As IValidationTrend;
    Rub := Mb.ItemById("OBJ_FC").Bind As IRubricator;
    MetaAttr := Rub.Facts.Attributes.FindById("COUNTRY");
    MetaAttrValList := Trend.TargetData;
        MetaAttrVal := MetaAttrValList.FindByKey(MetaAttr.Key);
        If MetaAttrVal <> Null Then
            MetaAttrVal.Value := 512;
        Else
            MetaAttrVal := MetaAttrValList.Add(MetaAttr);
        End If;
    MetaAttrValList := Trend.ComparatorData;
        If MetaAttrValList.Item > 0 Then
            MetaAttrValList.Clear;
        End If;
        MetaAttrVal := MetaAttrValList.Add(MetaAttr);
        MetaAttrVal.Value := 419;
    MetaAttrFilter := Trend.Filter;
    MetaAttrFilter.Clear;
    ValidObj.Save;
    ValidExecSett := New ValidationExecuteSettings.Create;
    ValidExecRun := ValidFilter.Execute(ValidExecSett);
End Sub UserProc;

After executing the example the validation filter Trend is set: series trend, attribute COUNTRY is equal to 512, is compared with series trend, attribute COUNTRY is equal to 419. This filter is executed, the execution results are saved to database.

See also:

IMsMetaAttributeValueList