ICalculateCubeScheduledTask.SetSelection

Syntax

SetSelection(Value: IDimSelectionSet);

Parameters

Value. The selection of the source cube, according to which the data loading to the consumer cube will be executed.

Description

The SetSelection method sets selection, according to which the data is loaded in a cube during task execution. The method is used when task for starting a cube loader is used.

Example

Executing the example requires that the repository contains a cube loader and a scheduled tasks container with the Cube_Load and CUBE_TASK identifiers, respectively.

Sub Main;

Var

MB: IMetabase;

MObj, Parent: IMetabaseObject;

Loader: ICubeLoader;

CrInfo: IMetabaseObjectCreateInfo;

LoaderTask: ICalculateCubeScheduledTask;

CubeIns: ICubeInstance;

Per: IScheduledTaskPeriodDaily;

Prop: IScheduledTaskProperties;

DimSS: IDimSelectionSet;

DimS: IDimSelection;

d: DateTime;

Begin

MB := MetabaseClass.Active;

//Scheduled tasks container

Parent := MB.ItemById("CUBE_TASK").Bind;

// Cube loader

Loader := Mb.ItemById("Cube_Load").Bind As ICubeLoader;

CrInfo := MB.CreateCreateInfo;

CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_TASK_CALCULATECUBE;

CrInfo.Id := "LoaderTask";

CrInfo.Name := Task of launching a cube loader;

CrInfo.Parent := Parent;

CrInfo.Permanent := False;

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

//task of launching a cube loader

LoaderTask := MObj As ICalculateCubeScheduledTask;

//Receiving selection by which data loading is to be performed

CubeIns := (Loader.Destination.Cube As IMetabaseObject).Open(Null) As ICubeInstance;

DimSS := CubeIns.Destinations.DefaultDestination.CreateDimSelectionSet;

//All elements in selection

For Each DimS In DimSS Do

DimS.SelectAll;

End For;

LoaderTask.SourceCube := (Loader As ICubeModel);

//configuring task properties

Prop := LoaderTask.Properties;

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 := 3;

Prop.Period := Per;

LoaderTask.SetSelection(DimSS);

MObj.Save;

End Sub Main;

After executing the example the task of starting a cube loader 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:

ICalculateCubeScheduledTask