Template: IEtlTemplate;
Template: Prognoz.Platform.Interop.KeFore.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.
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.Drawing;
Imports Prognoz.Platform.Interop.Etl;
Imports Prognoz.Platform.Interop.KeFore;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
EtlTask: IEtlTask;
Etl, ETLEdit: IEtlPlainDataFixedUser;
Paramss: ISharedParams;
Templates: IEtlTemplates;
Template: IEtlTemplate;
Inputs: IEtlPlainInputs;
Outputs: IEtlPlainOutputs;
Rect: IWxRectangle;
WxETL: WxEtlObjectClass = New WxEtlObjectClass();
PointF: GxPointFClass = New GxPointFClass();
Begin
// Get repository
MB := Params.Metabase;
// Get ETL task
EtlTask := MB.ItemById["ETL_Tsk"].Edit() As IEtlTask;
// Create a user transformer in task
Etl := EtlTask.Create(EtlObjectType.eotPlainDataFixedUser) As IEtlPlainDataFixedUser;
Etl.Id := "PlainDataFixedUser";
Etl.Name := "User algorithm";
// Use template
Paramss := MB.SpecialObject[MetabaseSpecialObject.msoSharedParams].Edit() As ISharedParams;
Templates := Paramss.EtlTemplates[ETLTemplateType.etlttProvider];
Template := Templates.Add();
Template.Module := mb.ItemById["USERSCLASSFORETL"];
Template.@Class := "User";
Template.Id := "TemplID";
Template.Name := "TemplName";
Etl.Template := Template;
(Paramss As IMetabaseObject).Save();
// Add transformer input, output, template
ETLEdit.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.EtlObject := Etl;
Rect.Style.TextPosition := WxTextPosition.wtpBottom;
Rect.Style.PictureMarginTop := -10;
PointF.Create(50, 50);
Rect.PinPosition := PointF;
Rect.Extension := WxETL As IWxShapeExtension;
// Save changes
(EtlTask As IMetabaseObject).Save();
End Sub;
See also: