ICubeCacheUpdateScheduledTask.SetSelection

Syntax

SetSelection(Value: IDimSelectionSet);

Parameters

Value. The cube selection, according to which data cache is updated.

Description

The SetSelection method sets the selection, according to which data cache is updated for the cube on executing the task.

Example

Executing the example requires a cube with the CUBE_ID identifier with the enabled data caching and also 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(NullAs 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(12000);
    Properties.Period := Period;
    (ScheduledTask As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the task of cache update for the CUBE_ID cube by the specified display version and specified selection is created in the SCHEDULED_TASK_CONTAINER scheduled tasks container. The task will be executed monthly on Monday of the third week of the month at 12:00.

See also:

ICubeCacheUpdateScheduledTask