IExecuteEtlScheduledTask.SourceTask

Syntax

SourceTask: IEtlTask;

Description

The SourceTask property determines ETL task that must be executed.

Example

Executing the example requires that the repository contains a scheduled tasks container with the TASK_CONTAINTER identifier and an ETL task with the Etl_1 identifier.

Sub Main;

Var

MB: IMetabase;

CrInfo: IMetabaseObjectCreateInfo;

MObj: IMetabaseObject;

Etl: IExecuteEtlScheduledTask;

Period: IScheduledTaskPeriodMonthly;

Prop: IScheduledTaskProperties;

i: Integer;

Begin

MB := MetabaseClass.Active;

CrInfo := MB.CreateCreateInfo;

CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_TASK_EXECUTEETL;

CrInfo.Id := "ETL_EXECUTOR";

CrInfo.Name := "ETL task execution";

CrInfo.Parent := MB.ItemById("TASK_CONTAINTER");

MObj := MB.CreateObject(CrInfo).Edit;

Etl := MObj As IExecuteEtlScheduledTask;

Etl.SourceTask := MB.ItemById("Etl_1").Bind As IEtlTask;

Prop := Etl.Properties;

Period := Prop.CreatePeriod(ScheduledTaskPeriodType.Monthly) As IScheduledTaskPeriodMonthly;

Period.DayOfWeek := CalendarDayOfWeek.LocaleDefault;

Period.Day := 1;

For i := 1 To 12 Do

Period.Months(i As CalendarMonth) := True;

End For;

Period.StartTime := DateTime.ComposeTimeOfDay(12, 0, 0, 0);

Prop.Period := Period;

MObj.Save;

End Sub Button1OnClick;

After executing the example a new task for executing ETL task is created in scheduled task container. ETL task will be run every first day of every month at 12:00.

See also:

IExecuteEtlScheduledTask