AddEx(Value: 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.
See also: