On working with the express report, which is built on several sources, shared dimensions for all sources are displayed as separate dimensions. The dimensions that are unique for the sources are united into a separate dimensions and are displayed on the Private Dimensions tab. Sometimes it may require to move one of shared dimensions to Private Dimensions. Consider an example of such moving by means of the Fore and Fore.NET languages.
Executing the example requires a form with the Button1 button, the TabSheetBox, ErAnalyzerDimPanel component and the UiErAnalyzer component named UiErAnalyzer1 that is a data source for the mentioned visual components. For the Fore.NET Example - existing of the .NET form and similar .NET components. An express report built on several sources is connected to UiErAnalyzer1. A dimension with the Country identifier is among shared dimensions.
Apart from the assemblies that will be connected automatically, it is also required to add links to the Cubes, Dimensions, Express, Metabase, Pivot repository system assemblies.
<font color="#008080">Sub</font> Button1OnClick(Sender: Object; Args: IMouseEventArgs);<br /> <font color="#008080">Var</font><br /> Analyzer: IEaxAnalyzer;<br /> Pivot: IPivot;<br /> Selection, NewSel: IDimSelection;<br /> DataSources: IEaxDataSources;<br /> FixInfo: ICubeDimensionFixInfo;<br /> VirtualCube: IVirtualCube;<br /> CompoundSelection: ICompoundSelection;<br /> SourcesSelection: IDimSelectionSet;<br /> SourceSelection: ICompoundSelection;<br /> DimFix: ICubeDimensionFix;<br /> DimKey, CompoundDimKey, i: Integer;<br /> <font color="#008080">Begin</font><br /> Analyzer := UiErAnalyzer1.ErAnalyzer;<br /> Pivot := Analyzer.Pivot;<br /> <font color="#008000">//Selection of dimension that will be moved into private ones<br /></font> <font color="#008000">//This dimension is contained in all express report sources<br /></font> <font color="#008000">//Selection is required for its further restoring in a composite selection of a private dimension<br /></font> Selection := Pivot.Selection.FindById(<font color="#800000">"COUNTRY"</font>);<br /> <font color="#008000">//Key of a moved dimension<br /></font> DimKey := Selection.Dimension.Key;<br /> <font color="#008000">//Fixation of dimension in a virtual cube, which is created under express report<br /></font> DataSources := Analyzer.DataSources;<br /> <font color="#008080">For</font> i := <font color="#008000">0</font> <font color="#008080">To</font> DataSources.Count - <font color="#008000">1</font> <font color="#008080">Do</font><br /> FixInfo := DataSources.Item(i).VirtualCubeSource.FixInfo;<br /> DimFix := FixInfo.FindByKey(DimKey);<br /> DimFix.Fixed := <font color="#008080">True</font>;<br /> <font color="#008080">End</font> <font color="#008080">For</font>;<br /> <font color="#008000">//Getting of composite selection, which includes all selections of private dimensions<br /></font> VirtualCube := (Pivot.DataSource <font color="#008080">As</font> ICubeInstanceDestination).Cube.Cube <font color="#008080">As</font> IVirtualCube;<br /> CompoundDimKey := (VirtualCube.FactDimension <font color="#008080">As</font> IMetabaseObjectDescriptor).Key;<br /> CompoundSelection := Pivot.Selection.FindByKey(CompoundDimKey) <font color="#008080">As</font> ICompoundSelection;<br /> <font color="#008000">//Collection of selections of private dimensions<br /></font> <font color="#008000">//Each selection private dimension in its turn is a composite selection of dimensions, which are unique for<br /></font> <font color="#008000">//a certain data source<br /></font> SourcesSelection := CompoundSelection.Selection;<br /> Pivot.BeginSelectionUpdate;<br /> <font color="#008080">For</font> <font color="#008080">Each</font> SourceSelection <font color="#008080">In</font> SourcesSelection <font color="#008080">Do</font><br /> <font color="#008000">//Adding to selection of a private dimension a selection of moved dimension<br /></font> NewSel := SourceSelection.Selection.Add(Selection.Dimension);<br /> <font color="#008000">//Restoring of its selection, in according to the one, which was before moving<br /></font> Selection.CopyTo(NewSel, <font color="#008080">True</font>);<br /> <font color="#008080">End</font> <font color="#008080">For</font>;<br /> Pivot.EndSelectionUpdate;<br /> <font color="#008000">//Refreshing of data sources<br /></font> DataSources.Refresh;<br /> <font color="#008080">End</font> <font color="#008080">Sub</font> Button1OnClick;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Pivot;
<font color="#008080">Private</font> <font color="#008080">Sub</font> button1_Click(sender: System.Object; e: System.EventArgs);<br /> <font color="#008080">Var</font><br /> Analyzer: EaxAnalyzer;<br /> Pivot: IPivot;<br /> Selection, NewSel: IDimSelection;<br /> DataSources: IEaxDataSources;<br /> FixInfo: ICubeDimensionFixInfo;<br /> VirtualCube: IVirtualCube;<br /> CompoundSelection: ICompoundSelection;<br /> SourcesSelection: IDimSelectionSet;<br /> SourceSelection: ICompoundSelection;<br /> DimFix: ICubeDimensionFix;<br /> DimKey, CompoundDimKey: UInteger;<br /> i: Integer;<br /> <font color="#008080">Begin</font><br /> Analyzer := UiErAnalyzerNet1.ErAnalyzer.ErAnalyzer;<br /> Pivot := Analyzer.Pivot;<br /> <font color="#008000">//Selection of dimension, which will be moved into private ones<br /></font> <font color="#008000">//This dimension is contained in all express report sources<br /></font> <font color="#008000">//Selection is required for its further restoring in composite selection of private dimension<br /></font> Selection := Pivot.Selection.FindById(<font color="#800000">"COUNTRY"</font>);<br /> <font color="#008000">//Key of a moved dimension<br /></font> DimKey := Selection.Dimension.Key;<br /> <font color="#008000">//Fixation of dimension in the virtual cube, which is created under express report<br /></font> DataSources := Analyzer.DataSources;<br /> <font color="#008080">For</font> i := <font color="#008000">0</font> <font color="#008080">To</font> DataSources.Count - <font color="#008000">1</font> <font color="#008080">Do</font><br /> FixInfo := DataSources.Item[i].VirtualCubeSource.FixInfo;<br /> DimFix := FixInfo.FindByKey(DimKey);<br /> DimFix.Fixed := <font color="#008080">True</font>;<br /> <font color="#008080">End</font> <font color="#008080">For</font>;<br /> <font color="#008000">//Getting of composite selection, which includes all selections of private dimensions<br /></font> VirtualCube := (Pivot.DataSource <font color="#008080">As</font> ICubeInstanceDestination).Cube.Cube <font color="#008080">As</font> IVirtualCube;<br /> CompoundDimKey := (VirtualCube.FactDimension <font color="#008080">As</font> IMetabaseObjectDescriptor).Key;<br /> CompoundSelection := Pivot.Selection.FindByKey(CompoundDimKey) <font color="#008080">As</font> ICompoundSelection;<br /> <font color="#008000">//Collection of selections of private dimensions<br /></font> <font color="#008000">//Each selection of private dimension in its turn is a composite selection of dimensions, which are unique for<br /></font> <font color="#008000">//a certain data source<br /></font> SourcesSelection := CompoundSelection.Selection;<br /> Pivot.BeginSelectionUpdate();<br /> <font color="#008080">For</font> <font color="#008080">Each</font> SourceSelection <font color="#008080">In</font> SourcesSelection <font color="#008080">Do</font><br /> <font color="#008000">//Adding to selection a private dimension of selection of moved dimension<br /></font> NewSel := SourceSelection.Selection.Add(Selection.Dimension);<br /> <font color="#008000">//Restoring of its selection according with the one, which was before moving<br /></font> Selection.CopyTo(NewSel, <font color="#008080">True</font>);<br /> <font color="#008080">End</font> <font color="#008080">For</font>;<br /> Pivot.EndSelectionUpdate();<br /> <font color="#008000">//Refreshing of data sources<br /></font> DataSources.Refresh(<font color="#008080">False</font>);<br /> <font color="#008080">End</font> <font color="#008080">Sub</font>;
The list of dimensions looks as follows:
After clicking the button the lost of dimensions looks as follows:
See also: