ClearFields;
ClearFields();
The ClearFields method clears fields list of the data provider or data consumer.
Fields list is cleared without connecting to data provider or consumer.
Executing the example requires a table with the TBL_SOURCE identifier and an ETL task with the OBJ_ETL_TASK identifier, containing a repository provider with the META_PROVIDER identifier. Add links to the Metabase, Dt, Etl, Db system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
EtlTask: IEtlTask;
EtlProvider: IEtlPlainDataProvider;
MBProvider: IDtMetabaseProvider;
Begin
MB := MetabaseClass.Active;
//Get an ETL task
MObj := MB.ItemById("OBJ_ETL_TASK").Edit;
EtlTask := MObj As IEtlTask;
//Get a Repository Source object
EtlProvider := EtlTask.FindById("META_PROVIDER") As IEtlPlainDataProvider;
EtlProvider := EtlProvider.Edit;
//Data source setting
MBProvider := EtlProvider.Provider As IDtMetabaseProvider;
MBProvider.Dataset := MB.ItemById("TBL_SOURCE").Bind As IDatasetModel;
//Fill source fields
MBProvider.ClearFields;
EtlProvider.FillFromSource;
//Save source
EtlProvider.Save;
//Save Etl task
MObj.Save;
End Sub UserProc;
After executing the example repository source is set up to work with the TBL_SOURCE table.
Imports Prognoz.Platform.Interop.Db;
Imports Prognoz.Platform.Interop.Dt;
Imports Prognoz.Platform.Interop.Etl;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObject;
EtlTask: IEtlTask;
EtlProvider: IEtlPlainDataProvider;
MBProvider: IDtMetabaseProvider;
Begin
MB := Params.Metabase;
//Search ETL task. Repository object with the ETL identifier
MObj := MB.ItemById["OBJ_ETL_TASK"].Edit();
EtlTask := MObj As IEtlTask;
//Get Repository source object
EtlProvider := EtlTask.FindById("META_PROVIDER") As IEtlPlainDataProvider;
EtlProvider := EtlProvider.Edit();
//Data source setting
MBProvider := EtlProvider.Provider As IDtMetabaseProvider;
MBProvider.Dataset := MB.ItemById["TBL_SOURCE"].Bind() As IDatasetModel;
MBProvider.ClearFields();
EtlProvider.FillFromSource();
//Save source
EtlProvider.Save();
//Save Etl task
MObj.Save();
End Sub;
After executing the example repository source is set up to work with the TBL_SOURCE table.
See also: