Document: IMetabaseObjectDescriptor;
Document: Prognoz.Platform.Interop.Metabase.IMetabaseObjectDescriptor;
The Document property determines theDocument repository object, from which data is imported.
A source for data import from the Document repository object can be chosen from the following:
MS Excel document (xlsx, xls).
Text documents (txt, xml).
Web pages (html).
Databases Microsoft Access, Visual FoxPro, Dbase.
Executing the example requires an ETL task with the ETL identifier and a document with the DOCPROVIDER identifier that is a data source.
To display process and result of data import in the console window, the CallBack class, described in example of the IEtlExecutionCallback.OnObject.
Add links to the Metabase, ETL, and Dt system assemblies.
Sub UserProc;
Var
mb:IMetabase;
EtlTask: IEtlTask;
EtlProvider:IEtlPlainDataProvider;
CB: CallBack;
TextProvider : IDtTextProvider;
DocumentProvider : IDtDocument;
Begin
mb:=MetabaseClass.Active;
EtlTask:=mb.ItemById("ETL").Edit As IEtlTask;
//Create the Import from Text object
EtlProvider := EtlTask.Create(EtlObjectType.PlainDataTextProvider) As IEtlPlainDataProvider;
EtlProvider := EtlProvider.Edit;
EtlProvider.Id := "Text_Provider";
EtlProvider.Name := "Import from Text";
EtlProvider.Description := "Import from Text";
//Data source setting
TextProvider := EtlProvider.Provider As IDtTextProvider;
CB:=New CallBack.Create;
EtlTask.Execute(CB);
DocumentProvider := TextProvider As IDtDocument;
If DocumentProvider <> Null Then
DocumentProvider.Document := MB.ItemById("DOCPROVIDER");
End If;
(EtlTask As IMetabaseObject).Save;
End Sub UserProc;
After executing the example data is loaded from the specified document.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Etl;
Imports Prognoz.Platform.Interop.Dt;
…
Public Shared Sub Main(Params: StartParams);
Var
mb:IMetabase;
EtlTask: IEtlTask;
EtlProvider:IEtlPlainDataProvider;
CB: CallBack;
TextProvider : IDtTextProvider;
DocumentProvider : IDtDocument;
Begin
mb:=Params.Metabase;
EtlTask:=mb.ItemById["ETL"].Edit() As IEtlTask;
//Create the Import from Text object
EtlProvider := EtlTask.Create(EtlObjectType.eotPlainDataTextProvider) As IEtlPlainDataProvider;
EtlProvider := EtlProvider.Edit();
EtlProvider.Id := "Text_Provider";
EtlProvider.Name := "Import from Text";
EtlProvider.Description := "Import from Text";
//Data source setting
TextProvider := EtlProvider.Provider As IDtTextProvider;
CB:=New CallBack.Create();
EtlTask.Execute(CB);
DocumentProvider := TextProvider As IDtDocument;
If DocumentProvider <> Null Then
DocumentProvider.Document := MB.ItemById["DOCPROVIDER"];
End If;
(EtlTask As IMetabaseObject).Save();
End Sub;
See also:
IDtDocument | TheRepository Data Source