AcceptDataSelection: Boolean;
AcceptDataSelection: boolean;
The AcceptDataSelection property determines whether the selected selection should be converted to visual selection.
Available values:
True. The selected selection is converted to visual selection.
False. The selected selection is not converted to visual selection.
Executing the example requires that the repository contains a dashboard with the DASHBOARD_SELECTION identifier. This dashboard should contain only two blocks, and they should use the same data source.
Add links to the Adhoc, Dimensions, Metabase system assemblies.
Sub UserProc;
Var
mb: IMetabase;
AdHoc: IAdHocReport;
Mobj: IMetabaseObject;
DSObjects: IAdhocDataSourceObjects;
DSobj1, DSobj2: IAdhocDataSourceObject;
DSdims1, DSdims2: IAdhocDsoDimensions;
Di1, Di2, Dc1, Dc2: Integer;
CurDim1, CurDim2: IAdhocDsoDimension;
DimKey: Integer;
Sync : IAdhocSynchronization;
DimSync: IAdhocDimsSynchronization;
SyncIdx: IAdhocDimSyncIndex;
ConIdx: integer;
Begin
// Get dashboard
mb := MetabaseClass.Active;
Mobj := mb.ItemById("DASHBOARD_SELECTION").Edit;
AdHoc := Mobj As IAdHocReport;
// Get synchronization parameters
Sync := AdHoc.Synchronization;
DimSync := Sync.Dimensions;
DimSync.Clear;
// Get dashboard data sources
DSObjects := AdHoc.DataSourceObjects;
DSobj1 := DSObjects.Item(0);
DSobj2 := DSObjects.Item(1);
// Get data source dimensions
DSdims1 := DSobj1.Dimensions;
DSdims2 := DSobj2.Dimensions;
Dc1 := DSdims1.Count;
Dc2 := DSdims2.Count;
ConIdx := 0;
// Set up synchronization by all data source dimensions
For Di1 := 0 To Dc1 - 1 Do
CurDim1 := DSdims1.Item(Di1);
If CurDim1.Type = AdhocDimensionType.SelectedArea Then
DimKey := CurDim1.Dimension.Key;
For Di2 := 0 To Dc2 - 1 Do
CurDim2 := DSdims2.Item(Di2);
If CurDim2.Type = AdhocDimensionType.SelectedArea Then
If DimKey = CurDim2.Dimension.Key Then
ConIdx := ConIdx + 1;
SyncIdx := DimSync.Add("Con" + ConIdx.ToString);
SyncIdx.Dimensions.Add(CurDim1);
SyncIdx.Dimensions.Add(CurDim2);
End If;
End If;
End For;
End If;
End For;
// Disable selected selection conversion to visual selection
DSobj1.AcceptDataSelection := False;
// Save changes
Mobj.Save
End Sub UserProc;
Imports Prognoz.Platform.Interop.Adhoc;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
AdHoc: IAdHocReport;
Mobj: IMetabaseObject;
DSObjects: IAdhocDataSourceObjects;
DSobj1, DSobj2: IAdhocDataSourceObject;
DSdims1, DSdims2: IAdhocDsoDimensions;
Di1, Di2, Dc1, Dc2: Integer;
CurDim1, CurDim2: IAdhocDsoDimension;
DimKey: UInteger;
Sync: IAdhocSynchronization;
DimSync: IAdhocDimsSynchronization;
SyncIdx: IAdhocDimSyncIndex;
ConIdx: integer;
Begin
// Get dashboard
mb := Params.Metabase;
Mobj := mb.ItemById["DASHBOARD_SELECTION"].Edit();
AdHoc := Mobj As IAdHocReport;
// Get synchronization parameters
Sync := AdHoc.Synchronization;
DimSync := Sync.Dimensions;
DimSync.Clear();
// Get dashboard data sources
DSObjects := AdHoc.DataSourceObjects;
DSobj1 := DSObjects.Item[0];
DSobj1.GetSourceObject();
DSobj2 := DSObjects.Item[1];
DSobj2.GetSourceObject();
// Get data source dimensions
DSdims1 := DSobj1.Dimensions;
DSdims2 := DSobj2.Dimensions;
Dc1 := DSdims1.Count;
Dc2 := DSdims2.Count;
ConIdx := 0;
// Set up synchronization by all data source dimensions
For Di1 := 0 To Dc1 - 1 Do
CurDim1 := DSdims1.Item[Di1];
If CurDim1.Type = AdhocDimensionType.adtSelectedArea Then
DimKey := CurDim1.Dimension.Key;
For Di2 := 0 To Dc2 - 1 Do
CurDim2 := DSdims2.Item[Di2];
If CurDim2.Type = AdhocDimensionType.adtSelectedArea Then
If DimKey = CurDim2.Dimension.Key Then
ConIdx := ConIdx + 1;
SyncIdx := DimSync.Add("Con" + ConIdx.ToString());
SyncIdx.Dimensions.Add(CurDim1);
SyncIdx.Dimensions.Add(CurDim2);
End If;
End If;
End For;
End If;
End For;
// Disable selected selection conversion to visual selection
DSobj1.AcceptDataSelection := False;
// Save changes
Mobj.Save()
End Sub;
After executing the example the synchronization of the selected data is set up for the dashboard blocks.
See also: