ControlledObjects: IMetabaseObjectDescriptors;
ControlledObjects: Prognoz.Platform.Interop.Metabase.IMetabaseObjectDescriptors;
The ControlledObjects property returns the collection of description of the repository objects used as analytical area data sources.
Executing the example requires that the repository contains a standard cube with the CUBE identifier and an express report with the EXPRESS_REPORT identifier. The express report contains two sheets, for which data sources displayed in analytical data area are selected.
Add links to the Express, Metabase, Cube system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Exp: IEaxAnalyzer;
ExpDs: IEaxDataSources;
Area: IEaxDataArea;
Sources: IEaxDataAreaSources;
ControlledObjects: IMetabaseObjectDescriptors;
Sheet: IEaxSheet;
Cube: IMetabaseObjectDescriptor;
CubeInstance: ICubeInstance;
i, Count: Integer;
Begin
// Get repository
MB := MetabaseClass.Active;
// Get express report
MObj := MB.ItemById("EXPRESS_REPORT").Edit;
Exp := MObj As IEaxAnalyzer;
// Get analytical area data sources
ExpDs := Exp.DataSources;
Area := Exp.DataArea;
Sources := Area.DataSources;
ControlledObjects := Sources.ControlledObjects;
// Create a new sheet
Sheet := Exp.Sheets.Add(Exp);
// Get new data source
Cube := MB.ItemById("CUBE");
ControlledObjects.Add(Cube);
// Add obtained data source to new sheet
CubeInstance := Cube.Open(Null) As ICubeInstance;
Sheet.Analyzer.OpenCube(CubeInstance);
// Save express report
MObj.Save;
// Display names of all used data sources on report sheets in the console
Count := ControlledObjects.Count;
For i := 0 To Count-1 Do
Debug.WriteLine(ControlledObjects.Item(i).Name);
End For;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Cube;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObject;
Exp: EaxAnalyzer;
ExpDs: IEaxDataSources;
Area: IEaxDataArea;
Sources: IEaxDataAreaSources;
ControlledObjects: IMetabaseObjectDescriptors;
Sheet: IEaxSheet;
Cube: IMetabaseObjectDescriptor;
CubeInstance: ICubeInstance;
i, Count: Integer;
Begin
// Get repository
MB := Params.Metabase;
// Get express report
MObj := MB.ItemById["EXPRESS_REPORT"].Edit();
Exp := MObj As EaxAnalyzer;
// Get analytical area data sources
ExpDs := Exp.DataSources;
Area := Exp.DataArea;
Sources := Area.DataSources;
ControlledObjects := Sources.ControlledObjects;
// Create a new sheet
Sheet := Exp.Sheets.Add(Exp);
// Get new data source
Cube := MB.ItemById["CUBE"];
ControlledObjects.Add(Cube);
// Add obtained data source to new sheet
CubeInstance := Cube.Open(Null) As ICubeInstance;
Sheet.Analyzer.OpenCube(CubeInstance);
// Save express report
MObj.Save();
// Display names of all used data sources on report sheets in the console
Count := ControlledObjects.Count;
For i := 0 To Count-1 Do
System.Diagnostics.Debug.WriteLine(ControlledObjects.Item[i].Name);
End For;
End Sub;
After executing the example, a new sheet with specified data source is added in the express report. The console displays names of all data sources used on report sheets, for example:
Cube of socially-economic indicators
Cube of financial indicators
Balance sheet cube
See also: