FindByKey(ParamKey: Integer): IMetabaseObjectParamControl;
FindByKey(ParamKey: UInteger): Prognoz.Platform.Interop.Metabase.IMetabaseObjectParamControl;
ParamKey. Nested object parameter key.
The FindByKey method finds and returns a binding of the nested object parameter to the parameters of the current object.
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.
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.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObject;
ObjParams: IMetabaseObjectParams;
ControlInfo: IMetabaseObjectControlInfo;
Control: IMetabaseObjectControl;
Param: IMetabaseObjectParamControl;
Begin
MB := Params.Metabase;
MObj := Mb.ItemById["STD_CUBE"].Edit();
//Parameters of the cube
ObjParams := MObj.Params;
ControlInfo := ObjParams.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 := ':' + ObjParams.FindByKey(1).Id + "+2000";
MObj.Save();
End Sub;
See also: