IDatasetDataProvider.FieldDefs

Fore Syntax

FieldDefs: IDatasetModelFields;

Fore.NET Syntax

FieldDefs: Prognoz.Platform.Interop.Db.IDatasetModelFields;

Description

The FieldDefs property returns the structure of a data source fields.

Fore Example

Executing the example requires the Data.xls Microsoft Excel file to be present in the root of disk C.

Sub UserProc;
Var
    ExcelProvider: IDtExcelProvider;
    Provider: IDatasetDataProvider;
    FieldDefs: IDatasetModelFields;
    FieldDef: IDatasetModelField;
    i: Integer;
Begin
    ExcelProvider := New DtExcelProvider.Create;
    ExcelProvider.DriverVersion := "Excel 8.0";
    ExcelProvider.File := "c:\Data.xls";
    ExcelProvider.HasHeader := True;
    ExcelProvider.ImexMode := DtExcelImexMode.Import;
    ExcelProvider.Query := "Select * From  [Sheet1$]";
    Provider := ExcelProvider As IDatasetDataProvider;
    FieldDefs := Provider.FieldDefs;
    For i := 0 To FieldDefs.Count - 1 Do
        FieldDef := FieldDefs.Item(i);
        Debug.WriteLine(FieldDef.Id + " " + FieldDef.DataType.ToString);
    End For;
End Sub UserProc;

On executing the example a new object that imports from Microsoft Excel files is created. The object is presented as a data source from which time series can be loaded to the time series database. The information about data source fields is displayed in the development environment console.

Fore.NET example

Executing the example requires the Data.xls Microsoft Excel file to be present in the root of disk C.

Imports System.Diagnostics;
Imports Prognoz.Platform.Interop.Dal;
Imports Prognoz.Platform.Interop.Db;
Imports Prognoz.Platform.Interop.Dt;

Private Sub UserProc();
Var
    ExcelProvider: IDtExcelProvider = New DtExcelProvider();
    Provider: IDatasetDataProvider;
    FieldDefs: IDatasetModelFields;
    FieldDef: IDatasetModelField;
    i: Integer;
Begin
    ExcelProvider.DriverVersion := "Excel 8.0";
    ExcelProvider.File := "c:\1.xls";
    ExcelProvider.HasHeader := True;
    ExcelProvider.ImexMode := DtExcelImexMode.eimImport;
    ExcelProvider.Query := "Select * From  [Sheet1$]";
    Provider := ExcelProvider As IDatasetDataProvider;
    FieldDefs := Provider.FieldDefs;
    For i := 0 To FieldDefs.Count - 1 Do
        FieldDef := FieldDefs.Item[i];
        Debug.WriteLine(FieldDef.Id + " " + FieldDef.DataType.ToString());
    End For;
End Sub;

On executing the example a new object that imports from Microsoft Excel files is created. The object is presented as a data source from which time series can be loaded to the time series database. The information about data source fields is displayed in the development environment console.

See also:

IDatasetDataProvider