Executing the example requires that the repository contains a multidimensional calculation with the MDCALC identifier, a standard parametric cube with the CUBE_DEST identifier that uses a dictionary with the PARAM_DICT identifier as a fact.
Sub UserProc;
Var
Mb: IMetabase;
dMd: IMetabaseObjectDescriptor;
MDcalc: IMDCalculation;
Destination: IMDCalculationDestination;
Cub: ICubeModel;
param: IMetabaseObjectParam;
objContrl: IMetabaseObjectControl;
Params: IMetabaseObjectParams;
DictParam: IMetabaseObjectDescriptor;
Begin
Mb := MetabaseClass.Active;
dMd := Mb.ItemById("MDCALC").Edit;
MDcalc := dMd As IMDCalculation;
// Determine destination cube
Cub := Mb.ItemById("CUBE_DEST").Bind As ICubeModel;
Destination := MDcalc.Destination;
Destination.SetCube(Cub);
// Create a parameter for multidimensional calculation
Params := (dMd As IMetabaseObject).Params;
param := Params.Add;
param.Id := "PARAM_1";
param.DataType := DbDataType.Integer;
// Set control of nested objects parameters
DictParam := Mb.ItemById("PARAM_DICT");
objContrl := Params.ControlInfo.FindByKey(DictParam.Key);
objContrl.Item(0).Expression.AsString := ":PARAM_1";
// Save calculation
(dMd As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the CUBE_DEST cube is set as a destination cube for multidimensional calculation on database server. A parameter that influences the parameter of destination cube dictionary is created in multidimensional calculation.
See also: