IMDCalculationScheduledTask.SourceCalculation

Syntax

SourceCalculation: IMDCalculation;

Description

The SourceCalculation property determines a multidimensional calculation on database 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 database server with the MDCalc identifier.

Add links to the Cube, Fore, and Metabase system assemblies.

Sub UserProc;
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 a 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 := "Execute multidimensional calculation on DB server";
    TaskObj := MB.CreateObject(CreateInfo).Edit;
    MDCalcTask := TaskObj As IMDCalculationScheduledTask;
    // Set executable multidimensional calculation
    MDCalcDescr := MB.ItemById("MDCalc");
    MDCalc := MDCalcDescr.Bind As IMDCalculation;
    MDCalcTask.SourceCalculation := MDCalc;
    // Set calculation execution parameters
    MDTabInst := MDCalcDescr.Open(NullAs IMDCalculationInstance;
    CalcArgs := MDTabInst.CreateCalculateArgs;
    CalcArgs.CleanType := MDCalculateArgsCleanType.Existing;
    CalcArgs.UpdateType := MDCalculateArgsUpdateType.NotNull;
    CalcArgs.Recursion := TriState.OnOption;
    MDCalcTask.SetCalculationArgs(CalcArgs);
    // Set execution periodicity
    Properties := MDCalcTask.Properties;
    PeriodTimeOnly := Properties.CreatePeriod(ScheduledTaskPeriodType.OneTimeOnly) As IScheduledTaskPeriodOneTimeOnly;
    PeriodTimeOnly.StartMode := TaskPeriodOneTimeStartMode.Immediate; //Immediate
    Properties.Period := PeriodTimeOnly;
    // Save task
    TaskObj.Save;
End Sub UserProc;

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

See also:

IMDCalculationScheduledTask