FieldDefs: IDatasetModelFields;
The FieldDefs property returns the structure of a data source fields.
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.
See also: