Selecting Data Source

Consider the example of selecting a data source of regular report.

Executing the example requires that the repository contains a regular report with the REPORT_INTRO identifier and a standard cube with the CUBE_SEP identifier.

Example

To execute the example, add links to the Metabase, Report, Cubes, Matrix system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Cube: ICubeInstance;
    Report: IPrxReport;
    MatrDS: IMatrixDataSource;
    DtSources: IPrxDataSources;
    DtSource: IPrxDataSource;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemById("REPORT_INTRO").Edit;
    // Select report data source:
    Cube := MB.ItemById("CUBE_SEP").Open(NullAs ICubeInstance;
    Report := MObj As IPrxReport;
    MatrDS := Cube.Destinations.DefaultDestination As IMatrixDataSource;
    DtSources := Report.DataSources;
    DtSource := DtSources.Add(MatrDS);
    MObj.Save;
End Sub UserProc;

After executing the example the specified cube is added as a data source of regular report.

See also:

General Principles of Programming using the Report Assembly