SetSelection(Value: IDimSelectionSet);
Value. The cube selection, according to which data cache is updated.
The SetSelection method sets the selection, according to which data cache is updated for the cube on executing the task.
Executing the example requires that the repository contains a cube with the CUBE_ID identifier with enabled data caching and a scheduled tasks container with the SCHEDULED_TASK_CONTAINER identifier.
Sub UserProc;
Var
Metabase: IMetabase;
ScheduledTask: ICubeCacheUpdateScheduledTask;
CrInfo: IMetabaseObjectCreateInfo;
CubIn: ICubeInstance;
CubInDes: ICubeInstanceDestination;
DimS: IDimSelection;
DimSS: IDimSelectionSet;
Properties: IScheduledTaskProperties;
Period: IScheduledTaskPeriodMonthly;
i: Integer;
Begin
Metabase := MetabaseClass.Active;
CrInfo := Metabase.CreateCreateInfo;
CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_TASK_UPDATE_CUBE_CACHE;
CrInfo.Parent := Metabase.ItemById("SCHEDULED_TASK_CONTAINER");
ScheduledTask := Metabase.CreateObject(CrInfo).Edit As ICubeCacheUpdateScheduledTask;
CubIn := Metabase.ItemById("CUBE_ID").Open(Null) As ICubeInstance;
CubInDes := CubIn.Destinations.DefaultDestination;
DimSS := CubInDes.CreateDimSelectionSet;
For Each DimS In DimSS Do
DimS.SelectAll;
End For;
ScheduledTask.SourceCube := CubIn.Cube;
ScheduledTask.DestKey := CubInDes.Key;
ScheduledTask.SetSelection(DimSS);
//Set task execution period
Properties := ScheduledTask.Properties;
Period := Properties.CreatePeriod(ScheduledTaskPeriodType.Monthly) As IScheduledTaskPeriodMonthly;
Period.DayOfWeek := CalendarDayOfWeek.Monday;
Period.WeekOfMonth := CalendarWeekOfMonth.Third;
For i := 1 To 12 Do
Period.Months(i As CalendarMonth) := True;
End For;
Period.StartTime := DateTime.ComposeTimeOfDay(12, 0, 0, 0);
Properties.Period := Period;
(ScheduledTask As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the scheduled cube cache update task by the specified display version and specified selection is created in the scheduled tasks container. The task will be executed monthly on Monday of the third week of the month at 12:00.
See also: