Table Getting

To work with data table, the ITabSheet interface is used.

The section contains different methods how to get table:

Getting Table from Regular Report

The example how to get the table from regular report with REPORT_TAB identifier is given.

Example

Executing the example requires to add links to the Metabase, Report, Tab assemblies.

Sub GetTable;
Var
    mb: IMetabase;
    Report: IPrxReport;
    Table: ITabSheet;
Begin
    // Get current repository
    mb := MetabaseClass.Active;
    // Get regular report
    Report := mb.ItemById("REPORT_TAB").Bind As IPrxReport;
    // Get table
    Table := (Report.ActiveSheet As IPrxTable).TabSheet;
End Sub GetTable;

Getting Table from Express Report

The example how to get the table from express report with the OLAP_TAB identifier is given.

Example

Executing the example requires to add links to the Express, Metabase, Tab system assemblies.

Sub GetTable;
Var
    mb: IMetabase;
    Report: IEaxAnalyzer;
    Table: ITabSheet;
Begin
    // Get current repository
    mb := MetabaseClass.Active;
    // Receive express report
    Report := mb.ItemById("OLAP_TAB").Bind As IEaxAnalyzer;
    // Get table
    Table := Report.Grid.TabSheet;
End Sub GetTable;

Getting Table Using the TabSheetBox Component

The example how to get the table using the TabSheetBoxcomponent is given.

Data Source - Express Report

Executing the example requires a form containing the TabSheetBox component with the TabSheetBox1 identifier and the UiErAnalyzer  component with the UiErAnalyzer1 identifier. It is required to have the OLAP_TAB express report in the repository.

Add a link to the Metabase system assembly.

Example

Sub GetTable;
Var
    mb: IMetabase;
    Table: ITabSheet;
Begin
    // Get current repository
    mb := MetabaseClass.Active;
    // Determine express report as a data source for UiErAnalyzer1
    UiErAnalyzer1.Object := mb.ItemById("OLAP_TAB");
    // Determine UiErAnalyzer1 as a data source for TabSheetBox1
    TabSheetBox1.Source := UiErAnalyzer1 As ITabSheetSource;
    // Activate UiErAnalyzer1
    UiErAnalyzer1.Active := True;
    // Get table
    Table := TabSheetBox1.Source.GetTabSheet;
End Sub GetTable;

Data Source - Regular Report

Executing the example requires a form containing the TabSheetBox component with the TabSheetBox1 identifier and the UIReport  component with the UiReport1 identifier. It is required to have regular report with the REPORT_TAB identifier in the repository.

Example

Add a link to the Metabase system assembly.

Sub GetTable;
Var
    mb: IMetabase;
    Table: ITabSheet;
Begin
    // Get current repository
    mb := MetabaseClass.Active;
    // Determine regular report as data source for UiReport1
    UiReport1.Object := mb.ItemById("REPORT_TAB");
    // Determine UiReport1 as data source for TabSheetBox1
    TabSheetBox1.Source := UiReport1 As ITabSheetSource;
    // Activate UiReport1
    UiReport1.Active := True;
    // Get table
    Table := TabSheetBox1.Source.GetTabSheet;
End Sub GetTable;

Data Source - Table which is not Linked to Repository

The UiTabSheet component allows to create tables which are not linked to data source from repository.

Executing the example requires a form containing the TabSheetBox component with the TabSheetBox1 identifier and the UiTabSheet component with the UiTabSheet1 identifier.

Example

Add a link to the Metabase system assembly.

Sub GetTable;
Var
    mb: IMetabase;
    Table: ITabSheet;
Begin
    // Get current repository
    mb := MetabaseClass.Active;
    // Determine UiTabSheet1 as data source for TabSheetBox1
    TabSheetBox1.Source := UiTabSheet1 As ITabSheetSource;
    // Get table
    Table := TabSheetBox1.Source.GetTabSheet;
End Sub GetTable;

See also:

General Programming Principles Using the Tab Assembly