File: String;
The File property determines the path and the name of the JSON file, to which data is to be imported.
Executing the example requires that the repository contains an ETL task with the ETL identifier.
Add links to the Andy, Drawing, Dt, Etl, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
EtlTask: IEtlTask;
EtlConsumer: IEtlPlainDataConsumer;
JSONConsumer: IDtJsonConsumer;
WxConsumer: IWxRectangle;
WxETLConsumer: IWxETLObject;
Begin
MB := MetabaseClass.Active;
//Search the ETL task. Repository object with the ETL identifier
MObj := MB.ItemById("ETL").Edit;
EtlTask := MObj As IEtlTask;
//Start data consumer creation
//Create the Export to JSON object
EtlConsumer := EtlTask.Create(EtlObjectType.PlainDataJsonConsumer) As IEtlPlainDataConsumer;
EtlConsumer := EtlConsumer.Edit;
EtlConsumer.Id := "JSON_Consumer";
EtlConsumer.Name := "Export to JSON";
EtlConsumer.Description := "Export to JSON";
//Set up data consumer
JSONConsumer := EtlConsumer.Consumer As IDtJsonConsumer;
JSONConsumer.File := "D:\Work\Output.json";
JSONConsumer.RootNodeName := "Data";
EtlConsumer.FillDefault;
//Save data consumer
EtlConsumer.Save;
//End of data consumer creation
//Start visual object creation
WxConsumer := EtlTask.Workspace.CreateRectangle;
WxETLConsumer := New WxETLObject.Create;
WxETLConsumer.ETLObject := EtlConsumer;
WxConsumer.Style.TextPosition := WxTextPosition.Bottom;
WxConsumer.Style.PictureMarginTop := -10;
WxConsumer.PinPosition := New GxPointF.Create(50, 50);
WxConsumer.Extension := WxETLConsumer As IWxShapeExtension;
//End of visual object creation
//Save ETL task
MObj.Save;
End Sub UserProc;
On executing the example a new data provider will be created in ETL task - Export to Json. The data provider is set up to export data to the D:\Work\Output.json file.
See also: