Template: IEtlTemplate;
The Template property determines a template for user algorithm.
The template is used to set user algorithm appearance on the desktop.
Executing the example requires that the repository contains:
A unit with the USERSCLASSFORETL identifier that contains the User class for implementing required interfaces.
An ETL task with the ETL_TASK identifier.
Add links to the Andy, Drawing, Etl, Fore, Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
EtlTask: IEtlTask;
Etl, ETLEdit: IEtlPlainDataFixedUser;
Params: ISharedParams;
Templates: IEtlTemplates;
Template: IEtlTemplate;
Inputs: IEtlPlainInputs;
Outputs: IEtlPlainOutputs;
Rect: IWxRectangle;
WxETL: IWxEtlObject;
Begin
// Get repository
MB := MetabaseClass.Active;
// Get ETL task
EtlTask := MB.ItemById("ETL_TASK").Edit As IEtlTask;
// Create a user transformer in task
Etl := EtlTask.Create(EtlObjectType.PlainDataFixedUser) As IEtlPlainDataFixedUser;
Etl.Id := "PlainDataFixedUser";
Etl.Name := "User algorithm";
// Use template
Params := MB.SpecialObject(MetabaseSpecialObject.SharedParams).Edit As ISharedParams;
Templates := Params.EtlTemplates(ETLTemplateType.Provider);
Template := Templates.Add;
Template.Module := mb.ItemById("USERSCLASSFORETL");
Template.Class_ := "User";
Template.Id := "TemplID";
Template.Name := "TemplName";
Etl.Template := Template;
(Params As IMetabaseObject).Save;
// Add transformer input, output, template
ETLEdit := ETl.Edit;
Inputs := ETLEdit.PlainInputs;
Inputs.Add;
Outputs := ETLEdit.PlainOutputs;
Outputs.Add;
// Save transformer changes
ETLEdit.Save;
// Create a visual representation of transformer
Rect := EtlTask.Workspace.CreateRectangle;
WxETL := New WxEtlObject.Create;
WxETL.EtlObject := Etl;
Rect.Style.TextPosition := WxTextPosition.Bottom;
Rect.Style.PictureMarginTop := -10;
Rect.PinPosition := New GxPointF.Create(50, 50);
Rect.Extension := WxETL As IWxShapeExtension;
// Save changes
(EtlTask As IMetabaseObject).Save;
End Sub UserProc;
After executing the example a data transformer based on template is created in the ETL task.
See also: