BeginUpdate;
The BeginUpdate method starts dimension update.
The method is recommended to be used on changing selection of controlling dimension to lock dependent dimension update. After applying selection by controlling dimension, unlock update of dependent dimensions.
The method is used for regular report where a data source is a cube with controlling dimensions.
The BeginUpdate method is applied with the EndUpdate method:
When the BeginUpdate method is called, dependent dimension update is locked.
After the EndUpdate method is called, dependent dimensions are updated.
To execute the example:
Create a regular report.
Add a standard cube with controlling dimensionsas a data source. One of dimensions with the Customers identifier, on which other dimensions depend.
Add a slice to data area .
Drag the added slice to the report sheet using Drag&Drop.
Create an event handler.
Add links to the Report, Dimensions system assemblies in the unit.
Set update of dimensions on selection change for the OnBeforeExecuteReport event:
Public Sub OnBeforeExecuteReport(Report: IPrxReport; Var Cancel: Boolean);
Var
DtSources: IPrxDataSources;
Slices: IPrxSlices;
SliceDim: IPrxSliceDimension;
Begin
Report := PrxReport.ActiveReport;
// Determine report data source
DtSources := Report.DataSources;
// Determine slice and slice dimension by identifier
Slices := DtSources.Item(0).Slices;
SliceDim := Slices.Item(0).LeftHeader.FindById("Customers");
// Initialize dimension update by determined selections
SliceDim.BeginUpdate;
SliceDim.Selection.DeselectAll;
SliceDim.Selection.selectelement(1, True);
SliceDim.Selection.selectelement(2, True);
SliceDim.EndUpdate;
End Sub OnBeforeExecuteReport;
In the regular report, after clicking the Update button on the Home ribbon tab the event occurs, which changes determined dimension selection and dependent dimensions are adjusted according to this selection.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Dimensions;
Public Override Sub OnBeforeExecuteReport(Report: IPrxReport; Var Cancel: Boolean);
Var
DtSources: IPrxDataSources;
Slices: IPrxSlices;
SliceDim: IPrxSliceDimension;
DI: IPrxDataIsland;
Begin
// Determine report data source
DtSources := Report.DataSources;
// Determine slice and slice dimension by identifier
Slices := DtSources.Item[0].Slices;
SliceDim := Slices.Item[0].LeftHeader.FindById("Customers");
// Initialize dimension update by determined selections
SliceDim.BeginUpdate();
SliceDim.Selection.DeselectAll();
SliceDim.Selection.selectelement(1, True);
SliceDim.Selection.selectelement(2, True);
SliceDim.EndUpdate();
End Sub OnBeforeExecuteReport;
See also: