IAdhocReport.Synchronization

Syntax

Synchronization: IAdhocSynchronization;

Description

The Synchronization property returns parameters of synchronization of dashboard dimensions.

Comments

On adding a new data source its dimensions are automatically added to the list of synchronized dimensions.

Example

Executing the example requires that the repository contains a dashboard with the ADHOC_SYNC identifier and a cube with the CUBE identifier.

Add links to the Adhoc, Cubes, Dimensions, Express, Matrix, Metabase system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    cr_info: IMetabaseObjectCreateInfo;
    Cube: ICubeInstance;
    CubeDest: ICubeInstanceDestinations;
    MatrDS: IMatrixDataSource;
    new_ds: IEaxAnalyzer;
    Obj: IMetabaseObject;
    Adhoc: IAdhocReport;
    Sync: IAdhocSynchronization;
    Dims: IAdhocDimsSynchronization;
    DimIndex: IAdhocDimSyncIndex;
    i, j, k: Integer;
    SyncDims: IAdhocSyncDimensions;
    SyncItem: IAdhocDimSyncItem;
    DsoDim: IAdhocDsoDimension;
    DSObj: IAdhocDataSourceObject;
    DsoDims: IAdhocDsoDimensions;
Begin
    mb := MetabaseClass.Active;
    // Get dashboard
    Obj := mb.ItemById("ADHOC_SYNC").Edit;
    Adhoc := Obj As IAdhocReport;
    // Create a new express report
    cr_info := mb.CreateCreateInfo;
    cr_info.ClassId := MetabaseObjectClass.KE_CLASS_EXPRESSREPORT;
    // Add an express report to the dashboard
    new_ds := Adhoc.AddNewDataSourceObject(cr_info.Id, cr_info).GetSourceObject As IEaxAnalyzer;
    // Add a data source for the express report
    Cube := mb.ItemById("CUBE").Open(NullAs ICubeInstance;
    CubeDest := Cube.Destinations;
    MatrDS := CubeDest.DefaultDestination As IMatrixDataSource;
    new_ds.DataSources.Add(MatrDS);
    // Get data about synchronization of dimensions
    Sync := Adhoc.Synchronization;
    Dims := Sync.Dimensions;
    // Display received data in the console window
    Debug.WriteLine("Synchronized dimensions:");
    For i := 0 To Dims.Count - 1 Do
        DimIndex := Dims.Item(i);
        Debug.WriteLine(" -" + DimIndex.Name);
        If DimIndex.Selection <> Null Then
            Debug.WriteLine("   Selection: " + DimIndex.Selection.ToString);
        End If;
        SyncDims := DimIndex.Dimensions;
        Debug.WriteLine("   Links:");
        For j := 0 To SyncDims.Count - 1 Do
            SyncItem := SyncDims.Item(J);
            Debug.WriteLine("   - Identifier:" + SyncItem.Id);
            Debug.WriteLine("   - synchronization attribute: " + SyncItem.SyncAttribute);
            DsoDim := SyncItem.Dimension;
            Debug.WriteLine("      - dimension of the data source: " + DsoDim.Name);
            Debug.WriteLine("      - selection:" + DsoDim.Selection.ToString);
              DSObj := DsoDim.DataSource;
            DsoDims := DSObj.Dimensions;
            Debug.WriteLine("      - common synchronized interfaces of the source:");
            For k := 0 To DsoDims.Count - 1 Do
                Debug.WriteLine("     - " + DsoDims.Item(k).Name);
            End For;
        End For;
    End For;
    Obj.Save;
End Sub UserProc;

Example execution result: a data source based on the CUBE cube is added to the dashboard. The information on synchronized dimensions of a dashboard are displayed in the console window.

See also:

IAdhocReport