IPrxDocumentTables.ItemById

Fore Syntax

ItemById(Id: Integer): IPrxDocumentTable;

Fore.NET Syntax

ItemById(Id: Integer): Prognoz.Platform.Interop.Report.IPrxDocumentTable;

Parameters

Id. Data table identifier.

Description

The ItemById method returns data table parameters by its identifier.

Comments

Data table identifier can be obtained in the IPrxDocumentTable.Id property. Data table identifiers are generated automatically on inserting data areas on the table sheet. The ItemById method is relevant for use, if any set of identifiers already exists and there is no need to look over the entire collection by using the Item-Count properties.

Fore Example

Executing the example requires that the repository contains a regular report with the Report identifier. The text sheet named Document is created in the report, data tables are created on this sheet based on the data areas.

Sub UserProc;
Var
    MB: IMetabase;
    Report: IPrxReport;
    Doc: IPrxDocument;
    Tables: IPrxDocumentTables;
    Table: IPrxDocumentTable;
    i: Integer;
    IdArray: IArrayList;
Begin
    MB := MetabaseClass.Active;
    Report := MB.ItemById("Report").Bind As IPrxReport;
    Doc := Report.Sheets.FindByName("Document"As IPrxDocument;
    Tables := Doc.DocumentTables;
    //...
    //Selection of data table identifiers by any attribute
    //...
    IdArray := New ArrayList.Create;
    For i := 0 To Tables.Count - 1 Do
        Table := Tables.Item(i);
        If <Table selection condition> Then
            //Save identifier to dynamic array
            IdArray.Add(Table.Id);
        End If;
    End For;
    //...
    //Work with selected data tables
    //...
    For i := 0 To IdArray.Count - 1 Do
        Table := Tables.ItemById(IdArray.Item(i));
        //...
    End For;
End Sub UserProc;

The example shows in general how to get a collection of data tables, select required data tables and work with them further.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.ForeCollections;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Report;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Report: IPrxReport;
    Doc: IPrxDocument;
    Tables: IPrxDocumentTables;
    Table: IPrxDocumentTable;
    i: Integer;
    IdArray: IArrayList = New ArrayListClass();
Begin
    MB := Params.Metabase;
    Report := MB.ItemById["Report"].Bind() As IPrxReport;
    Doc := Report.Sheets.FindByName("Document"As IPrxDocument;
    Tables := Doc.DocumentTables;
    //...
    //Selection of data table identifiers by any attribute
    //...
    For i := 0 To Tables.Count - 1 Do
        Table := Tables.Item[i];
        If <Table selection condition> Then
            //Save identifier to dynamic array
            IdArray.Add(Table.Id);
        End If;
    End For;
    //...
    //Work with selected data tables
    //...
    For i := 0 To IdArray.Count - 1 Do
        Table := Tables.ItemById(IdArray.Item[i] As Integer);
        //...
    End For;
End Sub;

See also:

IPrxDocumentTables