IMDCalculationScheduledTask.SourceCalculation

Syntax

SourceCalculation: IMDCalculation;

Description

The SourceCalculation property determines a multidimensional calculation on DB server that must be executed.

Comments

Use the IMDCalculationScheduledTask.LoadCalculationArgs property to get multidimensional calculation parameters in already existing task.

Use the IMDCalculationScheduledTask.SetCalculationArgs property to set multidimensional calculation parameters.

Example

Executing the example requires a scheduled tasks container with the Scheduled_Tasks_Cont identifier and multidimensional calculation on DB server with the MDCalc identifier. Also, add links to the Cube, Fore and Metabase system assemblies.

Sub Main;

Var

MB: IMetabase;

CreateInfo: IMetabaseObjectCreateInfo;

ScheduledTaskContObjD: IMetabaseObjectDescriptor;

TaskObj: IMetabaseObject;

Properties: IScheduledTaskProperties;

PeriodTimeOnly: IScheduledTaskPeriodOneTimeOnly;

MDCalc: IMDCalculation;

MDCalcTask: IMDCalculationScheduledTask;

MDCalcDescr: IMetabaseObjectDescriptor;

CalcArgs: IMDCalculationCalculateArgs;

MDTabInst:IMDCalculationInstance;

Begin

Mb := MetabaseClass.Active;

// Create task

CreateInfo := MB.CreateCreateInfo;

CreateInfo.Permanent := True;

ScheduledTaskContObjD := MB.ItemById("Scheduled_Tasks_Cont");

CreateInfo.Parent := ScheduledTaskContObjD;

CreateInfo.ClassId := MetabaseObjectClass.KE_CLASS_TASK_CALCULATEMDCALCULATION;

CreateInfo.Id := MB.GenerateId("MDCalcScheduledTask");

CreateInfo.Name := Multidimensional calculation execution on the database server;

TaskObj := MB.CreateObject(CreateInfo).Edit;

MDCalcTask := TaskObj As IMDCalculationScheduledTask;

// Set executed multidimensional calculation

MDCalcDescr := MB.ItemById("MDCalc");

MDCalc := MDCalcDescr.Bind As IMDCalculation;

MDCalcTask.SourceCalculation := MDCalc;

//Set parameters of calculation execution

MDTabInst := MDCalcDescr.Open(Null) As IMDCalculationInstance;

CalcArgs := MDTabInst.CreateCalculateArgs;

CalcArgs.CleanType := MDCalculateArgsCleanType.Existing;

CalcArgs.UpdateType := MDCalculateArgsUpdateType.NotNull;

CalcArgs.Recursion := TriState.OnOption;

MDCalcTask.SetCalculationArgs(CalcArgs);

// Set periodicity of execution

Properties := MDCalcTask.Properties;

PeriodTimeOnly := Properties.CreatePeriod(ScheduledTaskPeriodType.OneTimeOnly) As IScheduledTaskPeriodOneTimeOnly;

PeriodTimeOnly.StartMode := TaskPeriodOneTimeStartMode.Immediate; //Immediately

Properties.Period := PeriodTimeOnly;

// Save task

TaskObj.Save;

End Sub Main;

After executing the example task of executing a multidimensional calculation on DB server is created in the scheduled tasks container. Periodicity of execution and calculation execution parameters are set for the created task.

See also:

IMDCalculationScheduledTask