IDmPivotTableDataSource.PivotTable

Syntax

PivotTable: IPivotTable;

Description

The PivotTable property determines the data table that contains data for data mining.

Comments

If the data for the data mining is located in a repository table, use the IDmTableDataSource interface.

Example

Executing the example requires that the repository contains:

Add links to the Express, Ms, Metabase, Pivot, Report, Stat, and Tab system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    OLAP: IEaxAnalyzer;
    PivotTableDS: IDmPivotTableDataSource;
    Pivot: IPivot;
    ReportDS, ExDS: IDmReportDataSource;
    Method: IDmMethod;
    Report: IPrxReport;
    Shs: IPrxSheets;
    Sheet: ITabSheet;
    DM: IDmHighlightExceptions;
    i, j: Integer;
    Attrs: Array Of Integer;
    Reports: IDmReports;
    DmReport: IDmReport;
Begin
    mb := MetabaseClass.Active;
    OLAP := mb.ItemByID("EXPRESS_DATAMINING").Bind As IEaxAnalyzer;
    // Data source that is a data table
    PivotTableDS := (New PivotTableDataSource.Create) As IDmPivotTableDataSource;
    Pivot := OLAP.Pivot;
    PivotTableDS.PivotTable := Pivot.ObtainTable;
    // Create calculation method
    Method := (New DataMiningMethod.Create) As IDmMethod;
    // Specify method type
    Method.Kind := DmMethodKind.HighlightExceptions;
    // Set input data source
    Method.InputDataSource := PivotTableDS As IDmDataSource;
    // Create a data source that is a regular report
    ReportDS := (New ReportDataSource.Create) As IDmReportDataSource;
    // Set data consumer
    Method.OutputDataSource := ReportDS;
    // Set up calculation method parameters
    DM := Method.Details As IDmHighlightExceptions;
    j := PivotTableDS.FieldCount;
    Attrs := New Integer[j - 1];
    For i := 0 To j - 2 Do
        Attrs[i] := i + 1;
    End For;
    DM.Attributes := Attrs;
    // Set threshold
    DM.Threshold := 0.4;
    // Perform analysis and output results
    Reports := Method.Execute;
    DmReport := reports.FindByType(DmReportType.HighlightExceptions);
    ReportDS := DmReport.Generate;
    ReportDS.TabSheet.View.Selection.SelectAll;
    ReportDS.TabSheet.View.Selection.Copy;
    // Get regular report, to which results will be loaded
    Report := mb.ItemByID("DM_REPORT_RES").Edit As IPrxReport;
    Shs := Report.Sheets;
    Shs.Clear;
    Sheet := (Shs.Add("", PrxSheetType.Table) As IPrxTable).TabSheet;
    Sheet.Table.Paste;
    Sheet.Columns(01).AdjustWidth;
    Sheet.Rows(01).AdjustHeight;
    Report.Sheets.Item(0).Name := ReportDS.Caption;
    // Save loaded data
    (Report As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the Exception Search data mining analysis will be executed for the EXPRESS express report data. Analysis results will be loaded to the DM_REPORT_RES report.

See also:

IDmPivotTableDataSource