ICubeExecuteSetupUnits.UnitOption

Fore Syntax

UnitOption: CubeExecuteSetupUnitOption;

Fore.NET Syntax

UnitOption: Prognoz.Platform.Interop.Cubes.CubeExecuteSetupUnitOption;

Description

The UnitOption property determines measurement units for calculation.

Fore 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.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Matrix;
Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub Main(Params: StartParams);
Var
    Mb: IMetabase;
    RubInst: IRubricatorInstance;
    CubeInst: ICubeInstance;
    Dest: ICubeInstanceDestination;
    Sels: IDimSelectionSet;
    Sel: IDimSelection;
    ExecSetup: ICubeExecuteSetup;
    DimSetup: ICubeExecuteDimSetup;
    Executor: ICubeInstanceDestinationExecutor;
    Result: IMatrix;
Begin
    Mb := Params.Metabase;
    //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.cubdimtagUnits);
    //Specify measurement units to execute calculation in
    (DimSetup.Predefined As ICubeExecuteSetupUnits).UnitOption := CubeExecuteSetupUnitOption.cubexesetunioptNormalized;
    //Create a calculator
    Executor := Dest.CreateExecutor();
    Executor.WithoutScaling := True;
    Executor.PrepareExecute(Sels);
    Executor.PerformExecute(False);
    //Get output matrix
    Result := Executor.Matrix;
End Sub;

See also:

ICubeExecuteSetupUnits