ErrorOutput(Index: Integer): IEtlPlainOutput;
ErrorOutput[Index: Integer]: Prognoz.Platform.Interop.Etl.IEtlPlainOutput;
Index. Output index with error records.
The ErrorOutput property returns parameters of the specified output with error records.
The current implementation allows only one output with error records for each converter, that is why the 0 value must be passed as the Index parameter.
Executing the example requires an ETL task with the ETL_Task identifier. The task contains a converter with the PLAINDATATRANSFORMER identifier and a data consumer with the ERRORCONSUMER identifier.
Sub UserProc;
Var
MB: IMetabase;
ETLTask: IEtlTask;
Transform: IEtlPlainDataTransformer;
ErrorConsumer: IEtlPlainDataConsumer;
Link: IEtlPlainLink;
Shapes: IWxShapes;
Begin
MB := MetabaseClass.Active;
ETLTask := MB.ItemById("ETL_Task").Edit As IEtlTask;
//Transformer
Transform := ETLTask.FindById("PLAINDATATRANSFORMER") As IEtlPlainDataTransformer;
//Error record consumer
ErrorConsumer := ETLTask.FindById("ERRORCONSUMER") As IEtlPlainDataConsumer;
//Link and set up output with error values
Transform.ErrorOverlimitPolicy := EtlErrorOverlimitPolicy.StopOutput;
Transform.ErrorStopLimit := 100;
//Link transformer output fields and error record consumer input
FillFields(ErrorConsumer.PlainInput.Fields, Transform.ErrorOutput(0).Fields);
//Create a link
Link := CreateLink(ETLTask, Transform.ErrorOutput(0), ErrorConsumer.PlainInput);
//Create a visual link
Shapes := ETLTask.Workspace.Shapes;
CreateWXLink(ETLTask, Shapes.FindById(Transform.Id), Shapes.FindById(ErrorConsumer.Id), Link);
(ETLTask As IMetabaseObject).Save;
End Sub UserProc;
//Fill input/output field lists
Sub FillFields(Fields, FieldsSource: IEtlPlainFields);
Begin
Fields := Fields.Edit;
Fields.Fill(FieldsSource);
Fields.Save;
End Sub FillFields;
//Create a link between objects
Function CreateLink(ETLTask: IEtlTask; Output: IEtlPlainOutput; Input: IEtlPlainInput): IEtlPlainLink;
Var
Link: IEtlPlainLink;
Begin
Link := ETLTask.CreatePlainLink;
Link.SourceObjectOutput := Output;
Link.DestinationObjectInput := Input;
Link.FillDefault;
Return Link;
End Function CreateLink;
//Create visual links
Sub CreateWXLink(ETLTask: IEtlTask; Shape1: IWxShape; Shape2: IWxShape; Link: IEtlPlainLink);
Var
WLink: IWxLink;
WxETLLink: IWxEtlObject;
Begin
//Create visual link objects
WLink := ETLTask.Workspace.AutoLinkShapes(Shape1, Shape2);
WLink.Style.LinePenBeginWxCap := WxLineCap.Flat;
WLink.Style.LinePenEndWxCap := WxLineCap.Arrow30DegreeFilled;
WxETLLink := New WxEtlObject.Create;
WxETLLink.EtlObject := Link;
WLink.Extension := WxETLLink As IWxShapeExtension;
End Sub CreateWXLink;
After executing the example the input with error records is set up for the PLAINDATATRANSFORMER converter:
The consumer, to which error records are exported, is specified.
The limit of 100 records is set, on exceeding of which error records are not exported.
The link between converter and consumer is created and set up, an appropriate visual object is created.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Andy;
Imports Prognoz.Platform.Interop.Etl;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
ETLTask: IEtlTask;
Transform: IEtlPlainDataTransformer;
ErrorConsumer: IEtlPlainDataConsumer;
Link: IEtlPlainLink;
Shapes: IWxShapes;
Begin
MB := Params.Metabase;
ETLTask := MB.ItemById["ETL_Task"].Edit() As IEtlTask;
//Transformer
Transform := ETLTask.FindById("PLAINDATATRANSFORMER") As IEtlPlainDataTransformer;
//Error record consumer
ErrorConsumer := ETLTask.FindById("ERRORCONSUMER") As IEtlPlainDataConsumer;
//Link and set up output with error values
Transform.ErrorOverlimitPolicy := EtlErrorOverlimitPolicy.eopStopOutput;
Transform.ErrorStopLimit := 100;
//Link transformer output fields and error record consumer input
FillFields(ErrorConsumer.PlainInput.Fields, Transform.ErrorOutput[0].Fields);
//Create a link
Link := CreateLink(ETLTask, Transform.ErrorOutput[0], ErrorConsumer.PlainInput);
//Create a visual link
Shapes := ETLTask.Workspace.Shapes;
CreateWXLink(ETLTask, Shapes.FindById(Transform.Id), Shapes.FindById(ErrorConsumer.Id), Link);
(ETLTask As IMetabaseObject).Save();
End Sub;
//Create visual links
Public Shared Sub CreateWXLink(ETLTask: IEtlTask; Shape1: IWxShape; Shape2: IWxShape; Link: IEtlPlainLink);
Var
WLink: IWxLink;
WxETLLink: IWxEtlObject = New WxEtlObject();
Begin
//Create visual link objects
WLink := ETLTask.Workspace.AutoLinkShapes(Shape1, Shape2);
WLink.Style.LinePenBeginWxCap := WxLineCap.wlcFlat;
WLink.Style.LinePenEndWxCap := WxLineCap.wlcArrow30DegreeFilled;
WxETLLink.EtlObject := Link;
WLink.Extension := WxETLLink As IWxShapeExtension;
End Sub;
//Fill input/output field lists
Public Shared Sub FillFields(Fields, FieldsSource: IEtlPlainFields);
Begin
Fields := Fields.Edit();
Fields.Fill(FieldsSource);
Fields.Save();
End Sub;
//Create a link between objects
Public Shared Function CreateLink(ETLTask: IEtlTask; Output: IEtlPlainOutput; Input: IEtlPlainInput): IEtlPlainLink;
Var
Link: IEtlPlainLink;
Begin
Link := ETLTask.CreatePlainLink();
Link.SourceObjectOutput := Output;
Link.DestinationObjectInput := Input;
Link.FillDefault();
Return Link;
End Function;
See also: