OnEndBlock(Task: IEtlTask;
Object: IEtlObject;
Duration: Integer;
TotalRecIn: IDictionary;
TotalRecOut: IDictionary;
ErrorRec: IDictionary);
OnEndBlock(Task: Prognoz.Platform.Interop.Etl.IEtlTask;
Object: Prognoz.Platform.Interop.Etl.IEtlObject;
Duration: integer;
InRec: System.Collections.IDictionary;
OutRec: System.Collections.IDictionary;
ErrorRec: System.Collections.IDictionary);
Task. ETL task.
Object. ETL task object.
Duration. Block execution time in milliseconds.
TotalRecIn. Source table of records.
TotalRecOut. Consumer table of records.
ErrorRec. Table of skipped error records.
The OnEndBlock method implements ETL task block finish event.
ETL task block is a set of two objects and a link between them in the ETL task.
The following must be created for the TotalRecIn, TotalRecOut, ErrorRec parameters:
A table with the fields:
Id. Source table record identifier.
Value. Source table record value.
A table with the fields:
Id. Consumer table record identifier.
Value. Consumer table record value.
A table with the fields:
Id. Consumer table record identifier.
Value. Consumer table skipped record value.
To implement the event that occurs on ETL task block start, use IEtlTaskExecutionEvents.OnStartBlock.
To determine the Fore/Fore.NET object used as an event handler, and the class described in this object, use the IEtlTask.EventsAssembly and IEtlTask.EventsClass properties.
The example describes a class that can be used as ETL task event handler.
The class enables the user to get the ETLTaskRunId global variable that is used to get ETL task start identifier. The task use is given in the Using the ETLTaskRunId Global Variable example.
Add links to the Collections, Etl, Ui system assemblies.
Class EventsClass: EtlTaskExecutionEvents
// Event that occurs on ETL task start
Public Sub OnStartTask(Task: IEtlTask);
Begin
WinApplication.InformationBox("The OnStartTask event" + #13 + #10 +
"Number of ETL task objects = " + Task.Count.ToString);
End Sub OnStartTask;
// Event that occurs on ETL task end
Public Sub OnEndTask(Task: IEtlTask; Duration, TotalRec, ErrorRec: Integer);
Begin
WinApplication.InformationBox("The OnEndTask event" + #13 + #10 +
"Number of ETL task objects = " + Task.Count.ToString + #13 + #10 +
"Task execution progress = " + Duration.ToString + #13 + #10 +
"Number of records at input = " + TotalRec.ToString + #13 + #10 +
"Number of skipped records at output = " + ErrorRec.ToString);
End Sub OnEndTask;
// Event that occurs on ETL task block start
Public Sub OnStartBlock(Task: IEtlTask; Object: IEtlObject);
Begin
WinApplication.InformationBox("The OnStartBlock event" + #13 + #10 +
"Name of ETL task object - " + Task.Item(0).Name + #13 + #10 +
"ETL task object identifier - " + Object.Id);
End Sub OnStartBlock;
// Event that occurs on finishing ETL task block
Public Sub OnEndBlock(Task: IEtlTask; Object: IEtlObject; Duration: Integer; TotalRecIn, TotalRecOut, ErrorRec: IDictionary);
Begin
WinApplication.InformationBox("The OnEndBlock event" + #13 + #10 +
"Name of ETL task object - " + Task.Item(0).Name + #13 + #10 +
"ETL task object identifier - " + Object.Id + #13 + #10 +
"Task execution progress = " + Duration.ToString + #13 + #10 +
"Number of records at input = " + TotalRecIn.Count.ToString + #13 + #10 +
"Number of records at input = " + TotalRecOut.Count.ToString + #13 + #10 +
"Number of skipped records at output = " + ErrorRec.Count.ToString);
End Sub OnEndBlock;
// Event that occurs during ETL task execution
Public Sub OnProgress(Task: IEtlTask; Progress: Integer);
Begin
WinApplication.InformationBox("The OnProgress event" + #13 + #10 +
"Name of ETL task object - " + Task.Item(0).Name + #13 + #10 +
"Task execution progress = " + Progress.ToString);
End Sub OnProgress;
// Event that occurs on ETL task block error
Public Sub OnError(Task: IEtlTask; Object: IEtlObject; Excep: IException);
Begin
WinApplication.InformationBox("The OnError event" + #13 + #10 +
"Name of ETL task object - " + Task.Item(0).Name + #13 + #10 +
"ETL task object identifier - " + Object.Id + #13 + #10 +
"Error text - " + Excep.Message);
End Sub OnError;
End Class EventsClass;
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.ForeSystem;
Imports Prognoz.Platform.Interop.Ui;
Imports System.Windows.Forms;
Imports System.Collections;
…
Public Class EventsClass: EtlTaskExecutionEvents
// Event that occurs on ETL task start
Public Sub OnStartTask(Task: IEtlTask);
Begin
MessageBox.Show("The OnStartTask event" + "u000d\u000a" +
"Number of ETL task objects = " + Task.Count.ToString());
End Sub OnStartTask;
// Event that occurs on ETL task end
Public Sub OnEndTask(Task: IEtlTask; Duration, TotalRec, ErrorRec: Integer);
Begin
MessageBox.Show("The OnEndTask event" + "u000d\u000a" +
"Number of ETL task objects = " + Task.Count.ToString() + "u000d\u000a" +
"Task execution result = " + Duration.ToString() + "u000d\u000a" +
"Number of records at input = " + TotalRec.ToString() + "u000d\u000a" +
"Number of skipped records at output = " + ErrorRec.ToString());
End Sub OnEndTask;
// Event that occurs on ETL task block start
Public Sub OnStartBlock(Task: IEtlTask; Object: IEtlObject);
Begin
MessageBox.Show("The OnStartBlock event" + "u000d\u000a" +
"ETL task object name - " + Task.Item[0].Name + "u000d\u000a" +
"ETL task object identifier - " + Object.Id);
End Sub OnStartBlock;
// Event that occurs on finishing ETL task block
Public Sub OnEndBlock(Task: IEtlTask; Object: IEtlObject; Duration: integer; InRec, OutRec, ErrorRec: IDictionary);
Begin
MessageBox.Show("The OnEndBlock event" + "u000d\u000a" +
"ETL task object name - " + Task.Item[0].Name + "u000d\u000a" +
"ETL task object identifier - " + Object.Id + "u000d\u000a" +
"Task execution result = " + Duration.ToString() + "u000d\u000a" +
"Number of records at input = " + TotalRecIn.Count.ToString() + "u000d\u000a" +
"Number of records at input = " + TotalRecOut.Count.ToString() + "u000d\u000a" +
"Number of skipped records at output = " + ErrorRec.Count.ToString());
End Sub OnEndBlock;
// Event that occurs during ETL task execution
Public Sub OnProgress(Task: IEtlTask; Progress: Integer);
Begin
MessageBox.Show("The OnProgress event" + "u000d\u000a" +
"ETL task object name - " + Task.Item[0].Name + "u000d\u000a" +
"Task execution progress = " + Progress.ToString());
End Sub OnProgress;
// Event that occurs on ETL task block error
Public Sub OnError(Task: IEtlTask; Object: IEtlObject; Excep: Exception);
Begin
MessageBox.Show("The OnError event" + "u000d\u000a" +
"ETL task object name - " + Task.Item[0].Name + "u000d\u000a" +
"ETL task object identifier - " + Object.Id + "u000d\u000a" +
"Error text - " + Excep.Message);
End Sub OnError;
End Class EventsClass;
See also: