IMetabaseObjectControl.FindByKey

Syntax

FindByKey(ParamKey: Integer): IMetabaseObjectParamControl;

Parameters

ParamKey. Nested object parameter key.

Description

The FindByKey method finds and returns a binding of the nested object parameter to the parameters of the current object.

Comments

Each object has its own key range for parameters. Keys start with one.

If nested object does not have parameter with the determined key, the method returns Null.

Example

Executing the example requires a cube with the STD_CUBE identifier in repository. This cube has the dimension in the structure which is built basing the COUNTRY parametric dictionary. Dictionary has at least two parameters. One parameter is created in cube. Add a link to the Metabase system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Params: IMetabaseObjectParams;
    ControlInfo: IMetabaseObjectControlInfo;
    Control: IMetabaseObjectControl;
    Param: IMetabaseObjectParamControl;
Begin
    MB := MetabaseClass.Active;
    MObj := Mb.ItemById("STD_CUBE").Edit;
    //Parameters of the cube
    Params := MObj.Params;
    ControlInfo := Params.ControlInfo;
    Control := ControlInfo.FindByKey(MB.GetObjectKeyById("COUNTRY"));
    //Binding of the nested object parameters
    Param := Control.FindByKey(1);
    Param.Expression.AsString := "2000";
    Param := Control.FindByKey(2);
    Param.Expression.AsString := ':' + Params.FindByKey(1).Id + "+2000";
    MObj.Save;
End Sub UserProc;

On executing the example the parameter management is set up for the determined dictionary: the fixed value is sent as value of the first parameter; the second parameter value is calculated by formula and it will depend on the specified value of the cube parameter.

See also:

IMetabaseObjectControl