SourceCube: ICubeModel;
The SourceCube property determines a calculated cube or a cube loader that will be executed on task execution.
Executing the example requires that the repository contains a calculated cube and a scheduled tasks container with the Calc_Cube and CUBE_TASK identifiers, respectively.
Sub Main;
Var
MB: IMetabase;
Cube: ICubeModel;
MObj, Parent: IMetabaseObject;
CrInfo: IMetabaseObjectCreateInfo;
CalCubeTask: ICalculateCubeScheduledTask;
Per: IScheduledTaskPeriodDaily;
Prop: IScheduledTaskProperties;
d: DateTime;
Begin
Mb := MetabaseClass.Active;
//Scheduled tasks container
Parent := MB.ItemById("CUBE_TASK").Bind;
//Cub for calculation
Cube := Mb.ItemById("Calc_Cube").Bind As ICubeModel;
CrInfo := MB.CreateCreateInfo;
CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_TASK_CALCULATECUBE;
CrInfo.Id := "CalcCubeTask";
CrInfo.Name := Task of calculating a calculated cube;
CrInfo.Parent := Parent;
CrInfo.Permanent := False;
MObj := MB.CreateObject(CrInfo).Edit;
//Task of calculating a calculated cube
CalCubeTask := MObj As ICalculateCubeScheduledTask;
CalCubeTask.SourceCube := Cube;
//Configuring task properties
Prop := CalCubeTask.Properties;
//Launch daily with interval
Per := Prop.CreatePeriod(ScheduledTaskPeriodType.Daily) As IScheduledTaskPeriodDaily;
d := DateTime.Now;
d := d.Compose(d.Year, d.Month, d.Day, 18, 00, 00, 00);
Per.StartDateTime := d;
Per.EveryDays := 2;
Prop.Period := Per;
MObj.Save;
End Sub Main;
After executing the example the task of calculating a calculated cube is added to the scheduled tasks container. The task is started daily beginning with the current day at 18:00 with interval of two days.
See also: