Setting Up Controls

See the example of creating a control that is set up to a specific dimension of regular report data source.

Executing the example requires that the repository contains a regular report with the REPORT_INTRO identifier. A slice with the Slice identifier is determined for data source of regular report. One of data source dimensions is a calendar dictionary with the D_CALENDAR identifier.

Fore Example

To execute the example, add links to the Metabase and Report system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Report: IPrxReport;
    DtSources: IPrxDataSources;
    DtSource: IPrxDataSource;
    Slices: IPrxSlices;
    Dim: IPrxSliceDimension;
    Controls: IPrxReportControls;
    Control: IPrxControl;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemById("REPORT_INTRO").Edit;
    Report := MObj As IPrxReport;
    DtSources := Report.DataSources;
    DtSource := DtSources.Item(0);
    Slices := DtSource.Slices;
    Dim := Slices.FindByName("Slice").Dimensions.FindById("D_CALENDAR");
    Controls := Report.Controls;
    Control := Controls.Add(Null);
    Control.Id := "Calendar";
    Control.Name := "Calendar";
    Control.Dimension := Dim;
    Control.Appearance.Report := False;
    Control.Appearance.Sheet(Report.Sheets.Item(0)) := True;
    Control.AutoRecalc := True;
    Control.Binding := "UI="+Char.Chr(34)+"DimCombo"+Char.Chr(34);
    MObj.Save;
End Sub UserProc;

After executing the example a control in the form of a drop-down list is added; the control is set up to a calendar dimension of the data source.

Fore.NET Example

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;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Report: IPrxReport;
    DtSources: IPrxDataSources;
    DtSource: IPrxDataSource;
    Slices: IPrxSlices;
    Dim: IPrxSliceDimension;
    Controls: IPrxReportControls;
    Control: IPrxControl;
Begin
    MB := Params.Metabase;
    MObj := MB.ItemById["REPORT_INTRO"].Edit();
    Report := MObj As IPrxReport;
    DtSources := Report.DataSources;
    DtSource := DtSources.Item[0];
    Slices := DtSource.Slices;
    Dim := Slices.FindByName("Slice").Dimensions.FindById("D_CALENDAR");
    Controls := Report.Controls;
    Control := Controls.Add(Null);
    Control.Id := "Calendar";
    Control.Name := "Calendar";
    Control.Dimension := Dim;
    Control.Appearance.Report := False;
    Control.Appearance.Sheet[Report.Sheets.Item[0]] := True;
    Control.AutoRecalc := True;
    Control.Binding := "UI="+char.ConvertFromUtf32(34)+"DimCombo"+Char.ConvertFromUtf32(34);
    MObj.Save();
End Sub;

See also:

General Principles of Programming using the Report Assembly