IScheduledTaskProperties.ParamValues

Syntax

ParamValues: IMetabaseObjectParamValues;

Description

The ParamValues property determines the values of object parameters that are used during the task execution.

Example

Executing the example requires that the repository contains a scheduled tasks container with the TASK_CONTAINTER identifier and a module with the Module_1 identifier. The unit contains the Main procedure.

 Sub Main;

Var

MB : IMetabase;

CrInfo : IMetabaseObjectCreateInfo;

MObj : IMetabaseObject;

Exe : IExecuteSubScheduledTask;

Period : IScheduledTaskPeriodWeekly;

Prop : IScheduledTaskProperties;

sPar: String;

Pars: IMetabaseObjectParams;

Par: IMetabaseObjectParam;

Vals: IMetabaseObjectParamValues;

Val: IMetabaseObjectParamValue;

Begin

MB := MetabaseClass.Active;

CrInfo := MB.CreateCreateInfo;

CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_TASK_EXECUTESUB;

CrInfo.Id := "MODULE_EXECUTOR2";

CrInfo.Name := "Unit execution";

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

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

 

sPar := "Item";

Pars := MObj.Params;

Par := Pars.FindById(sPar);

If Par = Null Then

Par := Pars.Add;

Par.Id := sPar;

End If;

Par.Name := sPar;

Par.DataType := DbDataType.Integer;

Vals := Pars.CreateEmptyValues;

Val := Vals.FindById(sPar);

Val.Value := 7;

 

Exe := MObj As IExecuteSubScheduledTask;

Prop := Exe.Properties;

Prop.ParamValues := Vals;

 

Exe.Assembly := (MB.ItemById("Module_1").Bind As IModule).Assembly;

Exe.SubName := "Main";

Period := Prop.CreatePeriod(ScheduledTaskPeriodType.Weekly) As IScheduledTaskPeriodWeekly;

Period.DaysOfWeek(CalendarDayOfWeek.Monday) := True;

Period.DaysOfWeek(CalendarDayOfWeek.Wednesday) := True;

Period.DaysOfWeek(CalendarDayOfWeek.Friday) := True;

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

Prop.Period := Period;

MObj.Save;

End Sub Main;

After executing the example a new task of unit execution is created in the container. The unit will be running on Mondays, Wednesdays and Fridays at 12:00. Value of the parameter that can be used during the example execution is set to the unit.

See also:

IScheduledTaskProperties