Table Getting

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

The section contains different methods how to get table:

Get the Table from Regular Report

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

Fore Example

To execute the example, 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;

Fore.NET Example

Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    Report: IPrxReport;
    Table: ITabSheet;
Begin
    // Get current repository
    mb := Params.Metabase;
    // Get regular report
    Report := mb.ItemById["REPORT_TAB"].Bind() As IPrxReport;
    // Get table
    Table := (Report.ActiveSheet As IPrxTable).TabSheet;
End Sub;

Get the Table from Express Report

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

Fore Example

To execute the example, 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;

Fore.NET Example

Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Tab;

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    Report: IEaxAnalyzer;
    Table: ITabSheet;
Begin
    // Get current repository
    mb := Params.Metabase;
    // Receive express report
    Report := mb.ItemById["OLAP_TAB"].Bind() As IEaxAnalyzer;
    // Get table
    Table := Report.Grid.TabSheet;
End Sub;

Get the 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.

Fore 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;

Fore.NET Example

The requirements and result of the Fore.NET Example execution match with those in the Fore Example. Use Fore.NET analogs instead of Fore components.

Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Tab;

Private Sub GetTable();
Var
    mb: IMetabase;
    Table: ITabSheet;
Begin
    // Get current repository
    mb := Self.Metabase;
    // Determine express report as data source for uiErAnalyzerNet1
    uiErAnalyzerNet1.Object := mb.ItemById["OLAP_TAB"];
    // Determine uiErAnalyzerNet1 as data source for tabSheetBoxNet1
    tabSheetBoxNet1.Source := uiErAnalyzerNet1.ErAnalyzer As ITabSheetSource;
    // Activate uiErAnalyzerNet1
    uiErAnalyzerNet1.Active := True;
    // Get table
    Table := tabSheetBoxNet1.Source.GetTabSheet();
End Sub;

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.

Fore 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;

Fore.NET Example

The requirements and result of the Fore.NET Example execution match with those in the Fore Example. Use Fore.NET analogs instead of Fore components.

Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Tab;

Private Sub GetTable();
Var
    mb: IMetabase;
    Table: ITabSheet;
Begin
    // Get current repository
    mb := Self.Metabase;
    // Determine regular report as data source for uiReportNet1
    uiReportNet1.Object := mb.ItemById["REPORT_TAB"];
    // Determine uiReportNet1 as data source for tabSheetBoxNet1
    tabSheetBoxNet1.Source := uiReportNet1.ReportUi As ITabSheetSource;
    // Activate uiReportNet1
    uiReportNet1.Active := True;
    // Get table
    Table := tabSheetBoxNet1.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.

Fore 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;

Fore.NET Example

The requirements and result of the Fore.NET Example execution match with those in the Fore Example. Use Fore.NET analogs instead of Fore components.

Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Tab;

Private Sub GetTable();
Var
    mb: IMetabase;
    Table: ITabSheet;
Begin
    // Get current repository
    mb := Self.Metabase;
    // Determine uiTabSheetNet1 as data source for tabSheetBoxNet1
    tabSheetBoxNet1.Source := uiTabSheetNet1.TabSheetUi As ITabSheetSource;
    // Get table
    Table := tabSheetBoxNet1.Source.GetTabSheet();
End Sub GetTable;

See also:

General Programming Principles Using the Tab Assembly