Setting Up Report Objects

Consider an example of adding a chart with the data slice added before as a data source to a regular report sheet.

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 used as a data source of the report. A slice with the Slice identifier is determined for data source of regular report.

Example

To execute the example, add links to the Metabase, Report, Tab, Chart, Drawing system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Report: IPrxReport;
    Tab: ITabSheet;
    Chart: IPrxChart;
    ClassId: String;
    Placement: IGxRectF;
    Source: IPrxDataSource;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemById("REPORT_INTRO").Edit;
    Report := MObj As IPrxReport;
    Tab := (Report.ActiveSheet As IPrxTable).TabSheet;
    ClassId:="PrxChart";
    Placement:=New GxRectF.Create(50,50,200,200);
    Chart := (Tab.Objects.Add(ClassId,Placement)) As IPrxChart;
    Chart.SourceType := PrxChartSourceType.Slice;
    Source := Report.DataSources.FindById("CUBE_SEP");
    Chart.Slice := Source.Slices.FindByName("Slice");
    (Chart As IChart).Type := ChartType.Circles;
    MObj.Save;
End Sub UserProc;

After executing the example a chart with the slice of the specified data source as the data source will be added to the regular report sheet. Location on the sheet and the Pie Chart type are set for the chart.

See also:

General Principles of Programming using the Report Assembly