IStandardCubeServerAggregationDimensions.CalcOther

Syntax

CalcOther(Index: Integer): Boolean;

Parameters

Index. Dimension index.

Description

The CalcOther property determines whether aggregation for elements of dimension that are not included in selection must be calculated (the Other aggregate). Dimension index is passed by the Index parameter.

Comments

Available values:

In the matrix of aggregation calculation for dimensions, that were used to calculate the Other aggregate, the coordinate is -1.

Example

Executing the example requires that the repository contains a standard cube with the OBJ_CUBE identifier. This cube must contain two dimensions.

Sub Main;

Var

MB: IMetabase;

MObj: IMetabaseObject;

StandCub: IStandardCube;

CubeInst: ICubeInstance;

CubeStandInst: IStandardCubeInstance;

Aggregator: IStandardCubeServerAggregator;

StdDim: IStandardCubeDimension;

StdDims: IStandardCubeDimensions;

Aggregation: IStandardCubeServerAggregation;

FactDimension: IDimInstance;

Iter: IDimIterator;

AggDims: IStandardCubeServerAggregationDimensions;

MatrDS: IMatrixDataSource;

DimSS: IDimSelectionSet;

Matr: IMatrix;

Coord: IMatrixCoord;

i: Integer;

MatrIter: IMatrixIterator;

s: String;

Begin

MB := MetabaseClass.Active;

MObj := MB.ItemById("OBJ_CUBE").Bind;

StandCub := MObj As IStandardCube;

CubeInst := MObj.Open(Null) As ICubeInstance;

CubeStandInst := CubeInst As IStandardCubeInstance;

StdDims := StandCub.Dimensions;

 

// Set up aggregation method

Aggregator := CubeStandInst.CreateAggregator;

FactDimension := StandCub.FactDimension.OpenDimension;

Iter := FactDimension.Elements.Elements.Iterator;

Iter.First;

While Iter.Next Do

Aggregation := Aggregator.Aggregations.Add;

Aggregation.AggregationType := CubeFactBindingAggregationType.Sum;

Aggregation.FactKey := FactDimension.Indexes.PrimaryIndex.IndexAttributesValues(Iter.Element);

End While;

 

// Selection for aggregation calculation

MatrDS := CubeInst.Destinations.DefaultDestination As IMatrixDataSource;

DimSS := MatrDS.CreateDimSelectionSet;

For i := 0 To DimSS.Count - 1 Do

DimSS.Item(i).SelectAll;

End For;

 

// Calculate aggregation

Matr := Aggregator.Execute(DimSS);

 

// Display aggregation results

MatrIter := Matr.CreateIterator;

MatrIter.Move(IteratorDirection.First);

If MatrIter.Valid Then

For i := 0 To StdDims.Count - 1 Do

StdDim := StdDims.Item(i);

If StdDim.FactDimension Then

Debug.Write("Fact   ");

Else

Debug.Write(StdDim.OpenDimension.Name + "  ");

End If;

End For;

Debug.Write("Aggregation  ");

Debug.WriteLine("Value");

 

Coord := Matr.CreateCoord;

While MatrIter.Valid Do

MatrIter.PutCurrentPos(Coord);

s := "";

For i := 0 To Coord.Count - 1 Do

s := s + Coord.Item(i).ToString + "       ";

End For;

s := s + "= " + MatrIter.Value;

Debug.WriteLine(s);

MatrIter.Move(IteratorDirection.Next);

End While;

Else

Debug.WriteLine("No data");

End If;

End Sub Main;

After executing the example sum by dimensions is calculated for the cube facts. The calculation matrix is displayed in the console window.

View results

See also:

IStandardCubeServerAggregationDimensions