IEtlPlainDataCopy.EventId

Syntax

EventId: String;

Description

The EventId property determines identifier of the event called on occurring ETL task execution error.

Comments

To determine a method of handling the errors, which may occur on data loading, use the IEtlPlainDataCopy.ActionOnProblem property.

The custom events list is created in the IMetabaseCustomExtender.Events collection.

Example

Executing the example requires:

"Key","Country Name","Owner"

512,"Afghanistan",3

914,"Albania",1

612,"Algeria",2

A custom event with the CUSTOM_EVENT identifier is also added to the repository.

Add links to the Metabase, Etl, Dt, Db, Andy, Drawing system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Task: IEtlTask;
    CopyObj: IEtlPlainDataCopy;
    FProvider: IDtTextProvider;
    Tab: IDatasetModel;
    FConsumer: IDtMetabaseConsumer;
    ProvFields, ConsFields: IDtFieldDefinitions;
    i: Integer;
    WxConsumer: IWxRectangle;
    WxETLConsumer: IWxEtlObject;
Begin
    MB := MetabaseClass.Active;
    Task := MB.ItemById(
"ETL").Edit As IEtlTask;
    
// Create object that copies data
    CopyObj := Task.Create(EtlObjectType.PlainDataCopy) As IEtlPlainDataCopy;
    CopyObj := CopyObj.Edit;
    
// Set up data source parameters
    FProvider := New DtTextProvider.Create As IDtTextProvider;
    FProvider.File := 
"C:\ETL_imp.txt";
    FProvider.DelimitedColumnDelimiter := 
",";
    FProvider.HeaderRow := 
1;
    FProvider.FormatType := DtTextFormatType.Delimited;
    FProvider.RangeHasHeader := 
True;
    FProvider.RangeFirstRow := 
1;
    COpyObj.Provider := FProvider;
    
// Set up data consumer parameters
    FConsumer := New DtMetabaseConsumer.Create;
    Tab := MB.ItemById(
"TBL").Edit As IDatasetModel;
    FConsumer.Dataset := Tab;
    CopyObj.Consumer := FConsumer;
    
// Bind data of source and consumer
    ProvFields := FProvider.Fields;
    ConsFields := FConsumer.Fields;
    CopyObj.AutoLink;
    
For i := 0 To ProvFields.Count - 1 Do
        
If Not CopyObj.IsLinked(ProvFields.Item(i).Name, ConsFields.Item(i).Name) Then
            CopyObj.AddLink(ProvFields.Item(i).Name, ConsFields.Item(i).Name);
        
End If;
    
End For;
    
// Clear data consumer
    CopyObj.ClearConsumer := True;
    
// Handle errors
    CopyObj.ActionOnProblem := EtlActionOnProblem.DiscardRecordsInTransaction;
    CopyObj.SaveInvalidRecs := 
True;
    CopyObj.InvalidRecsFileName := 
"Errors";
    CopyObj.UseStopLimit := 
True;
    CopyObj.StopLimit := 
2;
    CopyObj.CommitCount := 
10;
    CopyObj.EventId := 
"CUSTOM_EVENT";
    
// Save object that copies data
    CopyObj.Save;
    
// Create a visual object
    WxConsumer := Task.Workspace.CreateRectangle;
    WxETLConsumer := 
New WxEtlObject.Create;
    WxETLConsumer.EtlObject := CopyObj;
    WxConsumer.Style.TextPosition := WxTextPosition.Bottom;
    WxConsumer.Style.PictureMarginTop := -
10;
    WxConsumer.PinPosition := 
New GxPointF.Create(5050);
    WxConsumer.Extension := WxETLConsumer 
As IWxShapeExtension;
    
// Save ETL task object
    (Task As IMetabaseObject).Save;
End Sub UserProc;

After executing the example a new object that copies data is created in ETL task. Copying is executed from a text file into a repository table. The following settings are determined for the Copy Data object:

See also:

IEtlPlainDataCopy