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.
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(Null) As 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.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Matrix;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObject;
Cube: ICubeInstance;
Report: IPrxReport;
MatrDS: IMatrixDataSource;
DtSources: IPrxDataSources;
DtSource: IPrxDataSource;
Begin
MB := Params.Metabase;
MObj := MB.ItemById["REPORT_INTRO"].Edit();
// Select report data source:
Cube := MB.ItemById["CUBE_SEP"].Open(Null) As ICubeInstance;
Report := MObj As IPrxReport;
MatrDS := Cube.Destinations.DefaultDestination As IMatrixDataSource;
DtSources := Report.DataSources;
DtSource := DtSources.Add(MatrDS);
MObj.Save();
End Sub;
See also: