Show contents 

Express > Express Assembly Interfaces > IEaxGrid > IEaxGrid.DrillRange

IEaxGrid.DrillRange

Syntax

DrillRange(Range: ITabRange; [DrillType: EaxDrillType = 1]);

Parameters

Range. Table cell range.

DrillType. Drilldown method that should be applied for a cell range.

Description

The DrillRange method drills down data for the selected table cell range.

Comments

The method is can be used if the IsRangeDrillable property or the specified cell range returns True. After executing the DrillRange method the selection in heading/sidehead dimensions, by which drilldown is available, is changed. Data is loaded to the table according to the new selection. The same table cells before and after drilldown have different binding to data source: data source may change during drilldown, cells will correspond to a different dimension selection. For details about cell range binding to data source, use the DrillRangeResult method.

Example

Executing the example requires that the repository contains an express report with the EXPRESS_REPORT identifier. The express report is based on the data source, which heading contains a calendar dimension with several element levels.

Add links to the Express, Metabase, Tab system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    Expr: IEaxAnalyzer;
    Grid: IEaxGrid;
    DataRange, DrillRange: ITabRange;
    DrillResult: IEaxDrillRangeResult;
Begin
    Mb := MetabaseClass.Active;
    // Open express report
    Expr := Mb.ItemById("EXPRESS_REPORT").Open(NullAs IEaxAnalyzer;
    Grid := Expr.Grid;
    // Range of data cells
    DataRange := Grid.SpecificRange(EaxRangeType.Internal);
    // Get the range consisting of three cells in the first row with data
    DrillRange := Grid.TabSheet.Cells(DataRange.Top, DataRange.Left, DataRange.Top, DataRange.Left + 2);
    // Check data can be drilled down
    If Grid.IsRangeDrillable(DrillRange) Then
        // Information about cell binding to data source before data drilldown
        Debug.WriteLine("Before drilldown:");
        DrillResult := Grid.DrillRangeResult(DrillRange);
        Debug.WriteLine("Data range (" + DrillRange.Address + ") corresponds to selection:");
        ShowRangeSelection(DrillResult.Selection);
        // Data drilldown
        Grid.DrillRange(DrillRange);
        // Information about cell binding to data source after data drilldown
        Debug.WriteLine("After drilldown:");
        DrillResult := Grid.DrillRangeResult(DrillRange);
        Debug.WriteLine("Data range (" + DrillRange.Address + ") corresponds to selection:");
        ShowRangeSelection(DrillResult.Selection);
    End If;
End Sub UserProc;

Sub ShowRangeSelection(DimSS: IDimSelectionSet);
Var
    DimS: IDimSelection;
    i, c: Integer;
    s: String;
Begin
    Debug.Indent;
    For Each DimS In DimSS Do
        c := DimS.SelectedCount;
        Debug.Write(DimS.Dimension.Name + ". Selected: " + c.ToString);
        If c = 1 Then
            Debug.WriteLine(". Element: " + DimS.Element(0).ToString);
        Else
            s := "";
            For i := 0 To c - 1 Do
                s := s + DimS.Element(i).ToString + ' ';
            End For;
            Debug.WriteLine(". Elements: " + String.Trim(s));
        End If;
    End For;
    Debug.Unindent;
End Sub ShowRangeSelection;

After executing the example the express report opens, the range of cells with data is obtained. The range consisting of three cells is selected in this range. It is checked if data can be drilled down in this data range. If data can be drilled down, it will be executed. The development environment console displays information about correspondence between the cell range and selection in the matrix with source data before and after drilldown.

See also:

IEaxGrid