ShowDataMiningWizard Command

Purpose

It opens the Data Mining tool.

Parameters of Use

Command parameters are sent in the IUiCommandExecutionContext.Data property as an array of the Variant type, which elements contain the values:

Value type Description
Element 1: IDmTableDataSource Table data source for data mining.
Element 2: DmMethodKind Data mining method.

Application Features

The displayed dialog box depends on whether parameters are set.

Example

Executing the example requires a form containing a button with the Button1 identifier.

It is required that the repository contains a table with the TABLE identifier containing data for analysis.

Add links to the Db, Fore, Metabase, Ms, Stat, UI system assemblies.

The example is a handler of the OnClick event for the Button1 button.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Mb: IMetabase;
    Table: ITable;
    DataSource: IDmTableDataSource;
    Target: IUiCommandTarget;
    Context: IUiCommandExecutionContext;
    Arg: array 
Of Variant;
Begin
    
// Get current repository
    Mb := MetabaseClass.Active;
    
// Get table
    Table := Mb.ItemById("TABLE").Bind As ITable;
    
// Create a data source that is table
    DataSource := (New TableDataSource.Create) As IDmTableDataSource;
    DataSource.Table := Table 
As IMetabaseObjectDescriptor;
    
// Get Ms plugin
    Target := WinApplication.Instance.GetPluginTarget("Ms");
    
// Create a context to execute a command
    Context := Target.CreateExecutionContext;
    
// Create command parameters array
    Arg := New Variant[2];
    Arg[
0] := DataSource;
    Arg[
1] := DmMethodKind.DecisionTree;
    
// Send command parameters array
    Context.Data := Arg;
    
// Execute the command
    Target.Execute("ShowDataMiningWizard", Context);
End Sub Button1OnClick;

Imports Prognoz.Platform.Interop.Db;
Imports Prognoz.Platform.Interop.Fore;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Stat;
Imports Prognoz.Platform.Interop.Ui;

Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    Mb: IMetabase;
    Table: ITable;
    DataSource: IDmTableDataSource;
    Target: IUiCommandTarget;
    WinApp: WinApplicationClassClass = 
New WinApplicationClassClass();
    RunContext: ForeRuntimeContext;
    Context: IUiCommandExecutionContext;
    Arg: array 
Of object;
Begin
    
// Get current repository
    Mb := Self.Metabase;
    
// Get table
    Table := Mb.ItemById["TABLE"].Bind() As ITable;
    
// Create a data source that is table
    DataSource := (New TableDataSource.Create()) As IDmTableDataSource;
    DataSource.Table := Table 
As IMetabaseObjectDescriptor;
    
// Get Ms plugin
    RunContext := (Mb As IForeServices).GetRuntime().Context;
    Target := WinApp.Instance[RunContext].GetPluginTarget(
"Ms");
    
// Create a context to execute a command
    Context := target.CreateExecutionContext();
    
// Create command parameters array
    Arg := New object[2];
    Arg[
0] := DataSource;
    Arg[
1] := DmMethodKind.dmmkDecisionTree;
    
// Send command parameters array
    Context.Data := Arg;
    
// Execute the command
    Target.Execute("ShowDataMiningWizard", Context, RunContext);
End Sub;

After executing the example, clicking the Button1 button displays the Data Mining dialog box, the Pattern Substitution analysis type, the Decision Tree method.

See also:

IUiCommandTarget.Execute