Extension: Object;
The Extension property returns additional settings that will be used on cube calculation.
In the current implementation the property returns additional settings for ADOMD cube dimensions. Cast value of this property to the IAdoMdExecuteDimSetup interface to specify additional settings.
Executing the example requires that the repository contains an ADOMD catalog with the ADOMDTest identifier, this catalog contains the SALES ADOMD cube. The cube structure must have dimensions based on ADOMD dictionaries with the DATE and COUNTRY identifiers.
Sub UserProc;
Var
MB: IMetabase;
CubeInst: ICubeInstance;
Dest: ICubeInstanceDestination;
SelSet: IDimSelectionSet;
Sel: IDimSelection;
DimSetup: ICubeExecuteDimSetup;
Calcs: IAdoMdDimCalculations;
Calc: IAdoMdDimCalculation;
Exec: ICubeInstanceDestinationExecutor;
AdoExec: IAdoMdCubeExecutor;
Mat: IMatrix;
Begin
MB := MetabaseClass.Active;
CubeInst := MB.ItemByIdNamespace("SALES", MB.GetObjectKeyById("ADOMDTest")).Open(Null) As ICubeInstance;
Dest := CubeInst.Destinations.DefaultDestination;
SelSet := Dest.CreateDimSelectionSet;
//Set selections
For Each Sel In SelSet Do
If Sel.Dimension.Ident = "COUNTRY" Then
DimSetup := CubeClass.SelectionSetup(Sel);
If DimSetup <> Null Then
DimSetup.GroupIndex := 2;
End If;
//Create a calculated element
Calcs := (DimSetup.Extension As IAdoMdExecuteDimSetup).Calculations;
Calc := Calcs.Add("");
Calc.Element(Sel.Dimension) := Sel.LastDimElement;
Calc.Expression := "SUM([DATE].[Year].Children)";
//Full selection
Sel.SelectAll;
Elseif Sel.Dimension.Ident = "DATE" Then
Sel.SelectElement(1, False);
DimSetup := CubeClass.SelectionSetup(Sel);
If DimSetup <> Null Then
DimSetup.GroupIndex := 1;
End If;
Else
Sel.SelectElement(1, False);
DimSetup := CubeClass.SelectionSetup(Sel);
If DimSetup <> Null Then
DimSetup.GroupIndex := 0;
End If;
End If
End For;
//Calculation
Exec := Dest.CreateExecutor;
AdoExec := Exec As IAdoMdCubeExecutor;
Exec.PrepareExecute(SelSet);
Exec.PerformExecute;
Mat := Exec.Matrix;
End Sub UserProc;
On executing the example a calculated element is added for the last element in the COUNTRY dimension. After this the cube is calculated, output matrix is available in the Mat variable.
See also: