ICubeExecuteSetupUnits.UnitOption

Syntax

UnitOption: CubeExecuteSetupUnitOption;

Description

The UnitOption property determines measurement units for calculation.

Example

Executing the example requires that the repository contains a time series database with the FC_DEP identifier. Measurement units are an optional series attribute.

Sub UserProc;
Var
    Mb: IMetabase;
    RubInst: IRubricatorInstance;
    CubeInst: ICubeInstance;
    Dest: ICubeInstanceDestination;
    Sels: IDimSelectionSet;
    Sel: IDimSelection;
    ExecSetup: ICubeExecuteSetup;
    DimSetup: ICubeExecuteDimSetup;
    Executor: ICubeInstanceDestinationExecutor;
    Result: IMatrix;
Begin
    Mb := MetabaseClass.Active;
    //Get TSDB instance
    RubInst := Mb.ItemById("FC_DEP").Open(NullAs IRubricatorInstance;
    CubeInst := RubInst As ICubeInstance;
    Dest := CubeInst.Destinations.DefaultDestination;
    //Create a selection to calculate
    Sels := Dest.CreateDimSelectionSet;
    For Each Sel In Sels Do
        Sel.SelectAll;
    End For;
    //Add measurement units
    Sels.Add(RubInst.UnitsDimension);
    ExecSetup := Sels As ICubeExecuteSetup;
    DimSetup := ExecSetup.FindByTag(CubeDimensionTag.Units);
    //Specify measurement units to execute calculation in
    (DimSetup.Predefined As ICubeExecuteSetupUnits).UnitOption := CubeExecuteSetupUnitOption.Natural;
    //Create a calculator
    Executor := Dest.CreateExecutor;
    Executor.WithoutScaling := True;
    Executor.PrepareExecute(Sels);
    Executor.PerformExecute;
    //Get output matrix
    Result := Executor.Matrix;
End Sub UserProc;

Executing the example causes the calculation of output matrix for DBMS series. Calculation is executed using source data. The output matrix is available in the Result variable.

See also:

ICubeExecuteSetupUnits