ControlledObject: IEaxDataAreaSlice;
The ControlledObject property returns the analytical data area slice for which parameter control is set up.
To determine an expression for binding report and slice parameters, use the IEaxDataAreaParamControl.Expression property.
Executing the example requires that the repository contains a regular report with the REPORT identifier. Parameters and a slice, on which the table is built, are added to the report. The cube with a parameter containing name and the TERRITORIA identifier is used as data source for slice.
Add links to the Dal, Express, Metabase, Report system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Report: IPrxReport;
Area: IEaxDataArea;
Slices: IEaxDataAreaSlices;
Slice: IEaxDataAreaSlice;
Control: IEaxDataAreaParamControl;
Info: IEaxDataAreaControlInfo;
SliceCtrl: IEaxDataAreaControl;
Parameters: IEaxDataAreaParams;
Param: IEaxDataAreaParam;
ParamMB: IMetabaseObjectParamValue;
i: Integer;
Begin
// Get repository
MB := MetabaseClass.Active;
// Get regular report
Report := MB.ItemById("REPORT").Edit As IPrxReport;
// Get analytical area of regular report
Area := Report.DataArea As IEaxDataArea;
// Get analytical area slices
Slices := Area.Slices;
// Get the first slice
Slice := Slices.Item(0);
// Display the number of slice parameters obtained on automatic generation
Parameters := Slice.Params;
Debug.WriteLine("Number of slice parameters: " + Parameters.Count.ToString);
//Disable automatic generation
Slice.GenerateSourceParams := False;
// Display the number of slice parameters after generation is disabled
Debug.WriteLine("Number of slice parameters after the generation is disabled: " + Parameters.Count.ToString);
// Add a slice parameter
Parameters.Clear;
Param := Parameters.AddNew;
Param.Id := "TERRITORIA";
Param.Name := "TERRITORIA";
Param.DataType := DbDataType.Integer;
// Get report parameters
ParamMB := Report.MetabaseObject.ParamValues.Item(0);
// Get object of slice parameter controlling setting
Info := Area.ControlInfo;
// Add a controlling setting object
SliceCtrl := Info.AddControl(Slice);
// Get slice for setting up control
Slice := SliceCtrl.ControlledObject;
// Add a controlling setting for slice parameter
Control := SliceCtrl.AddControl(Param.Id);
Debug.WriteLine("Slice parameter: " + Param.Name + '(' + Param.Id + ").");
For i := 0 To SliceCtrl.Count - 1 Do
Control := SliceCtrl.Item(i);
// Set expression determining parameter binding
Control.Expression.AsString := "{@" + (ParamMB.Id) + "}";
End For;
//Check whether slice parameter control is set up
Debug.WriteLine("Control is not specified: " + SliceCtrl.IsEmpty.ToString);
// Save report
Report.MetabaseObject.Save;
End Sub UserProc;
After executing the example the console displays:
The number of slice parameters before and after automatic generation is disabled.
Whether slice parameters are controlled.
The slice parameter will be linked to report parameter.
See also: