AddEx(Value: IMetabaseObjectDescriptor);
AddEx(Value: Prognoz.Platform.Interop.Metabase.IMetabaseObjectDescriptor);
Value. Object descriptor.
The AddEx method connects the source, which descriptor is passed in the Value parameter.
Use the method to connect an express report as a regular report data source.
If the user connects a cube or an express report with a saved view, on creating a slice settings of dimension layout and the selection are obtained from the express report or cube view.
Executing the example requires an express report with the EXP1 identifier and a regular report with the REP1 identifier. Create a form, then place on this form a button named Button1, the ReportBox component named ReportBox1, and the UiReport component named UiReport1, then specify UiReport1 as a source of ReportBox1. Add links to the Tab, Report, Metabase system assemblies.
Class OBJ62507Form: Form
ReportBox1: ReportBox;
UiReport1: UiReport;
Button1: Button;
rep: IPrxReport;
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var DS: IPrxDataSource;
er: IMetabaseObjectDescriptor;
dataS: IPrxDataSources;
DI: IPrxDataIsland;
DIs: IPrxDataIslands;
slice: IPrxSlice;
slices: IPrxSlices;
Begin
er := MetabaseClass.Active.ItemById("EXP1") As IMetabaseObjectDescriptor;
dataS := rep.DataSources;
dataS.AddEx(er);
DS := dataS.Item(rep.DataSources.Count - 1);
text := DS.Parent.Name;
slices := DS.Slices;
slice := slices.Add;
DIs := rep.DataIslands;
DI := DIs.Add;
DI.Slice := slice;
DI.Sheet := rep.Sheets.Item(0);
DI.Range := (rep.Sheets.Item(0) As IPrxTable).TabSheet.Cell(0, 0);
DI.OutputPart := PrxDataIslandPart.Full;
rep.Recalc;
rep.ActiveSheet := rep.Sheets.Item(0);
End Sub Button1OnClick;
Sub OBJ62507FormOnCreate(Sender: Object; Args: IEventArgs);
Begin
rep := MetabaseClass.Active.ItemById("REP1").Edit As IPrxReport;
UiReport1.Instance := rep;
End Sub OBJ62507FormOnCreate;
End Class OBJ62507Form;
After executing the example, clicking the Button1 adds the specified express report as a data source on the second sheet of the ReportBox component, the text of form window title shows the name of the specified express report.
Executing the example requires an express report with the EXP1 identifier and a regular report with the REP1 identifier. Create a form, then place on this form a button named Button1, the ReportBoxNet component named ReportBoxNet1, and the UiReportNet component named UiReportNet1, then specify UiReportnet1 as a source for ReportBoxNet1, and set the Active property of the UiReportNet1 component to True. Add links to the Tab, Report, Metabase system assemblies.
Imports System;
Imports System.Collections.Generic;
Imports System.ComponentModel;
Imports System.Data;
Imports System.Drawing;
Imports System.Text;
Imports System.Windows.Forms;
Imports Prognoz.Platform.Forms.NET;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Forms;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
Public Partial Class OBJ934Form: Prognoz.Platform.Forms.NET.ForeNetForm
Public Constructor OBJ934Form();
Begin
InitializeComponent();
End Constructor;
rep: IPrxReport;
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
DSS: IPrxDataSources;
DS: IPrxDataSource;
Sheets: IPrxSheets;
er: IMetabaseObjectDescriptor;
DI: IPrxDataIsland;
DIs: IPrxDataIslands;
slice: IPrxSlice;
Begin
er := self.Metabase.ItemById["EXP1"] As IMetabaseObjectDescriptor;
DSS := rep.DataSources;
DSS.AddEx(er);
DS := DSS.Item[DSS.Count - 1];
text := DS.Parent.Name;
slice := DS.Slices.Add();
DIs := rep.DataIslands;
DI := DIs.Add();
DI.Slice := slice;
Sheets := rep.Sheets;
DI.Sheet := Sheets.Item[0];
DI.Range := (Sheets.Item[0] As IPrxTable).TabSheet.Cell[0, 0];
DI.OutputPart := PrxDataIslandPart.pdipFull;
Rep.Recalc();
rep.ActiveSheet := rep.Sheets.Item[0];
End Sub;
Private Sub OBJ934Form_Load(sender: System.Object; e: System.EventArgs);
Begin
rep := self.Metabase.ItemById["REP1"].Edit() As IPrxReport;
uireportnet1.ReportUi.Instance := rep;
End Sub;
End Class;
After executing the example clicking the Button1 adds the specified express report as a data source on the second sheet of the ReportBoxNet component, the text of form window title shows the name of the specified express report.
See also: