SliceParams(Slice: IEaxDataAreaSlice): IEaxDataAreaSliceParams;
Slice. Analytical data area slice.
The SliceParams property returns parameters of analytical data area slice.
To add an analytical data area parameter in the collection, use the IEaxDataAreaParams.Add method.
Executing the example requires that the repository contains a regular report with the REPORT identifier and a cube with the CUBE identifier.
Add links to the Dal, Express, Metabase, Report, and Transform system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Report: IPrxReport;
DataArea: IEaxDataArea;
SlicesCount: Integer;
DataAreaSlice: IEaxDataAreaSlice;
Params: IEaxDataAreaParams;
Param, ParamItem: IEaxDataAreaParam;
SliceParams: IEaxDataAreaSliceParams;
index0, index1, index2, i: Integer;
Begin
MB := MetabaseClass.Active;
Report := mb.ItemById("REPORT").Edit As IPrxReport;
DataArea := Report.DataArea As IEaxDataArea;
SlicesCount := DataArea.Slices.Count - 1;
DataAreaSlice := DataArea.Slices.Item(SlicesCount);
Params := DataAreaSlice.Params;
SliceParams := Params.SliceParams(DataAreaSlice);
Params.Clear;
// Parameter 1:
Param := Params.AddNew;
Param.Hidden := False;
Param.Id := "ID1";
Param.Name := "MyParam1";
Param.LinkedObject := MB.ItemById("CUBE");
Param.ParamType := TsParamType.Simple;
Param.DataType := DbDataType.Integer;
Param.DefaultValue := 10;
Param.Value := 5;
index0 := SliceParams.IndexOf(Param);
// Parameter 2:
Param := Params.AddNew;
Param.Hidden := True;
Param.Id := "ID2";
Param.Name := "MyParam2";
Param.LinkedObject := MB.ItemById("CUBE");
Param.ParamType := TsParamType.Simple;
Param.DataType := DbDataType.Integer;
Param.DefaultValue := 20;
Param.Value := 10;
index1 := SliceParams.IndexOf(Param);
// Parameter 3:
Param := Params.AddNew;
Param.Hidden := True;
Param.Id := "ID3";
Param.Name := "MyParam3";
Param.LinkedObject := MB.ItemById("CUBE");
Param.ParamType := TsParamType.Simple;
Param.DataType := DbDataType.Integer;
Param.DefaultValue := 30;
Param.Value := 20;
index2 := SliceParams.IndexOf(Param);
Param.Tag := "Added parameters for analytical data area";
Debug.WriteLine("Added parameters for analytical data area. Slice: "
+ Param.Slice.Name + ". Parameters:");
For i := 0 To SliceParams.Count - 1 Do
ParamItem := SliceParams.Item(i);
Debug.WriteLine(i.ToString + ". " + ParamItem.Name);
End For;
Params.Move(index2, index0);
Debug.WriteLine("Changed parameters order:");
For i := 0 To Params.Count - 1 Do
Debug.WriteLine(i.ToString + ". " + Params.Item(i).Name);
End For;
Debug.WriteLine("Remove parameter: " + SliceParams.FindById("ID1").Name);
Params.Remove(index1);
Debug.WriteLine("Parameters order after removing:");
For i := 0 To Params.Count - 1 Do
Debug.WriteLine(i.ToString + ". " + Params.Item(i).Name);
End For;
Params.Update;
(Report As IMetabaseObject).Save;
End Sub UserProc;
After executing the example three parameters will be added for analytical data area slice. Next, the order of parameters in the collection will be changed. After this, one of the parameters will be removed.
See also: