SeparateParameters: Boolean;
SeparateParameters: Boolean;
The SeparateParameters property determines whether a single parameter is to be created in a virtual cube for each data source parameter.
The property is set to False by default, in this case single parameters are created in a virtual cube, which will control all parameters with the same identifier.
When the property is set to True, a single parameter will be created in a virtual cube for each data source parameter. Identifiers of the created parameters will be generated according to the rule: <Parameter ID>_<data source key>.
Executing the example requires that the repository contains a regular report with the REPORT identifier. The regular report contains several data sources added, based on which data slices for analytical data area are created. The data sources also have parameters with equal identifiers.
Add links to the Express, Metabase and Report system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
Report: IPrxReport;
DataArea: IEaxDataArea;
Source: IEaxDataAreaSource;
Sources: IEaxDataSources;
Begin
Mb := MetabaseClass.Active;
Report := Mb.ItemById("REPORT").Edit As IPrxReport;
DataArea := Report.DataArea;
Debug.WriteLine("---Parameters before recreation---");
ShowParams(DataArea);
//Recreate parameters
For Each Source In DataArea.DataSources Do
Sources := Source.VirtualSources;
Sources.SeparateParameters := True;
Sources.RecreateVirtualCubeParams;
End For;
Debug.WriteLine("---Parameters after recreation---");
ShowParams(DataArea);
(Report As IMetabaseObject).Save;
End Sub UserProc;
Sub ShowParams(DataArea: IEaxDataArea);
Var
Slice: IEaxDataAreaSlice;
Param: IMetabaseObjectParam;
Begin
For Each Slice In DataArea.Slices Do
Debug.WriteLine("Slice: " + Slice.Name);
For Each Param In Slice.Source.DataObject.Params Do
Debug.WriteLine(" " + Param.Id);
End For;
End For;
End Sub ShowParams;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Report;
Public Shared Sub Main(Params: StartParams);
Var
Mb: IMetabase;
Report: IPrxReport;
DataArea: IEaxDataArea;
Source: IEaxDataAreaSource;
Sources: IEaxDataSources;
Begin
Mb := Params.Metabase;
Report := Mb.ItemById["REPORT"].Bind() As IPrxReport;
DataArea := Report.DataArea;
System.Diagnostics.Debug.WriteLine("---Parameters before recreation---");
ShowParams(DataArea);
//Recreate parameters
For Each Source In DataArea.DataSources Do
Sources := Source.VirtualSources;
Sources.SeparateParameters := True;
Sources.RecreateVirtualCubeParams();
End For;
System.Diagnostics.Debug.WriteLine("---Parameters after recreation---");
ShowParams(DataArea);
End Sub;
Shared Sub ShowParams(DataArea: IEaxDataArea);
Var
Slice: IEaxDataAreaSlice;
Param: IMetabaseObjectParam;
Begin
For Each Slice In DataArea.Slices Do
System.Diagnostics.Debug.WriteLine("Slice: " + Slice.Name);
For Each Param In Slice.Source.DataObject.Params Do
System.Diagnostics.Debug.WriteLine(" " + Param.Id);
End For;
End For;
End Sub;
After executing the example, parameters will be recreated in the virtual cube that contains analytical data area data sources. A single parameter in the virtual cube will be created for each data source parameter.
See also: