IStandardCubeServerAggregator.DimensionSets

Syntax

DimensionSets: IStandardCubeServerDimensionSets;

Description

The DimensionSets property returns groups of dimensions, by which aggregation is calculated.

Comments

The property is outdated, use IStandardCubeServerAggregator.Dimensions.

Use one group of dimensions if it is necessary to calculate totals only by columns or by rows. Use two groups if it is necessary to calculate totals both by columns and by rows.

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;

DimSet: IStandardCubeServerDimensionSet;

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;

 

// Determine dimensions for aggregation

DimSet := Aggregator.DimensionSets.Add;

DimSet.CalcOther := True;

StdDim := StdDims.Item(1);

AggDims := DimSet.Dimensions;

AggDims.Add(StdDim);

AggDims.CalcOther(0) := True;

DimSet := Aggregator.DimensionSets.Add;

DimSet.CalcTotal := True;

StdDim := StdDims.Item(2);

AggDims := DimSet.Dimensions;

AggDims.Add(StdDim);

AggDims.CalcTotal(0) := True;

 

// 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);

 

// Dsplay 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("Aggreagtion  ");

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:

IStandardCubeServerAggregator