Laner: ILaner;
Laner: Prognoz.Platform.Interop.Laner.ILaner;
The Laner property determines the time series database workbook that contains data for data mining.
If the data for data mining is located in a repository table, use the IDmTableDataSource interface.
Executing the example requires:
A workbook with the WORKBOOK identifier that contains data for analysis.
A regular report with the DM_REPORT_RES identifier, to which analysis results are loaded.
Add links to the Metabase, Express, Ms, Report, Stat, Tab system assemblies.
Sub UserProc;
Var
mb: IMetabase;
OLAP: IEaxAnalyzer;
LanerDS: IDmLanerDataSource;
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("WORKBOOK_TEST").Bind As IEaxAnalyzer;
// Data source which is a workbook
LanerDS := (New LanerDataSource.Create) As IDmLanerDataSource;
LanerDS.Laner := OLAP.Laner;
// Create a data source that is a regular report
ReportDS := (New ReportDataSource.Create) As IDmReportDataSource;
// Create calculation method
Method := (New DataMiningMethod.Create) As IDmMethod;
// Specify method type
Method.Kind := DmMethodKind.HighlightExceptions;
// Set input data source
Method.InputDataSource := LanerDS As IDmDataSource;
// Set data consumer
Method.OutputDataSource := ReportDS;
// Set up calculation method parameters
DM := Method.Details As IDmHighlightExceptions;
j := LanerDS.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;
// Create output data source for loading of exceptions
ExDS := (New ReportDataSource.Create) As IDmReportDataSource;
// Specify output data source for loading of exceptions
DM.ExceptionsReportDataSource := ExDS;
// 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 unloaded
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(0, 1).AdjustWidth;
Sheet.Rows(0, 1).AdjustHeight;
Report.Sheets.Item(0).Name := ReportDS.Caption;
// Save unloaded data
(Report As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the Exception Search data mining method is executed for the WORKBOOK workbook data, data mining results are loaded to the DM_REPORT_RES report.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Stat;
Imports Prognoz.Platform.Interop.Tab;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
OLAP: IEaxAnalyzer;
LanerDS: IDmLanerDataSource;
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 := Params.Metabase;
OLAP := mb.ItemByID["WORKBOOK_TEST"].Bind() As IEaxAnalyzer;
// Data source which is a workbook
LanerDS := (New LanerDataSource.Create()) As IDmLanerDataSource;
LanerDS.Laner := OLAP.Laner;
// Create a data source that is a regular report
ReportDS := (New ReportDataSource.Create()) As IDmReportDataSource;
// Create calculation method
Method := (New DataMiningMethod.Create()) As IDmMethod;
// Specify method type
Method.Kind := DmMethodKind.dmmkHighlightExceptions;
// Set input data source
Method.InputDataSource := LanerDS As IDmDataSource;
// Set data consumer
Method.OutputDataSource := ReportDS;
// Set up calculation method parameters
DM := Method.Details As IDmHighlightExceptions;
j := LanerDS.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;
// Create output data source for loading of exceptions
ExDS := (New ReportDataSource.Create()) As IDmReportDataSource;
// Specify output data source for loading of exceptions
DM.ExceptionsReportDataSource := ExDS;
// Perform analysis and output results
Reports := Method.Execute();
DmReport := reports.FindByType[DmReportType.drtHighlightExceptions];
ReportDS := DmReport.Generate();
ReportDS.TabSheet.View.Selection.SelectAll();
ReportDS.TabSheet.View.Selection.Copy();
// Get regular report to which results will be unloaded
Report := mb.ItemByID["DM_REPORT_RES"].Edit() As IPrxReport;
Shs := Report.Sheets;
Shs.Clear();
Sheet := (Shs.Add("", PrxSheetType.pstTable) As IPrxTable).TabSheet;
Sheet.Table.Paste();
Sheet.Columns[0, 1].AdjustWidth(-1, -1);
Sheet.Rows[0, 1].AdjustHeight(-1, -1);
Report.Sheets.Item[0].Name := ReportDS.Caption;
// Save unloaded data
(Report As IMetabaseObject).Save();
End Sub;
See also: