DrillThrough: ICubeExecutorDrillThroughItems;
The DrillThrough property returns the collection of drillthrough elements on cube calculation.
To use the property, the ICubeInstanceDestinationExecutor.PerformExecuteO property must use value of the CubeInstanceDestinationExecutorOptions.DrillThrough enumeration as a parameter.
Executing the example requires that the repository contains a standard cube with the CUBE identifier.
Add links to the Cubes, Dal, Db, Dimensions, Matrix, Metabase system assemblies.
Sub UserProc;
Var
mb: IMetabase;
cube: ICubeInstance;
dest: ICubeInstanceDestination;
executor: ICubeInstanceDestinationExecutor;
selset: IDimSelectionSet;
i: Integer;
dtItems: ICubeExecutorDrillThroughItems;
Begin
// Get repository
mb := MetabaseClass.Active;
// Get cube
cube := mb.ItemById("OBJ13003").Open(Null) As ICubeInstance;
// Get object for working with default cube destination
dest := cube.Destinations.DefaultDestination;
// Get cube selection
selset := dest.CreateDimSelectionSet;
For i := 0 To selset.Count - 1 Do
selset.Item(i).SelectAll;
End For;
// Create an object for cube calculation
executor := dest.CreateExecutor;
// Prepare cube calculation
executor.PrepareExecute(selset);
// Prepare cube calculation with query drillthrough
executor.PerformExecuteO(CubeInstanceDestinationExecutorOptions.DrillThrough);
// Get collection of drillthrough elements on cube calculation
dtItems := executor.DrillThrough;
If dtItems.Count <> 0 Then
For i := 0 To dtItems.Count - 1 Do
// Display in the console window:
Debug.WriteLine("Number of values in obtained drillthrough output matrix = " + dtItems.Matrix.ValueCount.ToString);
Debug.WriteLine("SQL query:");
Debug.WriteLine(dtItems.Item(i).Command.SQL);
Debug.WriteLine("Number of data source fields = " + dtItems.Item(i).Dataset.Fields.Count.ToString);
End For;
Else
Debug.WriteLine("Number of drillthrough elements = 0");
End If;
End Sub UserProc;
After executing the example the console window displays SQL query of drillthrough element and the number of source fields.
See also: