ShowFormulaDialog Command

Purpose

Opens the functions wizard of a regular report.

Parameters of Use

Command parameters are passed in the Data property. Executing the command requires to specify an array of the Variant type in this property, the elements of this array contain the following values:

Value type Description
Element 1: IPrxReport The regular report, for which a function is created.
Element 2: String The function, on which the functions wizard pointer is focused. The name of function or an empty string if function is unknown must be defined as a value.

Application Features

The command is used only for regular reports. Executing the command shows logical True if the OK button is clicked, and logical False if the Cancel button is clicked. If the function was created, and the OK button is clicked in the wizard, this function can be obtained by getting the value of the Data property and casting it to the array. The value of the formula will be in the element 2 of array.

Fore Example

Executing the example requires a form with the Button1 button, the ReportBox component and the UiReport component named UiReport1, which is used as a data source for the ReportBox component. The UiReport1 component is connected to a regular report.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Target: IUiCommandTarget;
    Context: IUiCommandExecutionContext;
    Data: Array;
Begin
    Target := WinApplication.Instance.GetPluginTarget("Report");
    Context := Target.CreateExecutionContext;
    Data := New Variant[2];
    Data[0] := UiReport1.Instance;
    Data[1] := "Abs";
    Context.Data := Data;
    If (Target.Execute("ShowFormulaDialog", Context) As Boolean) Then
        Debug.WriteLine((Context.Data As Array)[1]);
    Else
        Debug.WriteLine("Creating of function is cancelled.");
    End If;
End Sub Button1OnClick;

Clicking the button opens the functions wizard. The pointer is focused on the Abs function. The full text of the function is displayed in the development environment console after the function is created, and the OK button is clicked.

Fore.NET Example

Executing the example requires a form, the Button1 button on the form, the ReportBoxNet component and the UiReportNet component named UiReportNet1, which is used as a data source for the ReportBoxNet component. The UiReport1 component is connected to a regular report.

Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Ui;

Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    WinApp: WinApplication = New WinApplicationClass_2();
    Target: IUiCommandTarget;
    Context: IUiCommandExecutionContext;
    Data: Array;
Begin
    Target := WinApp.GetPluginTarget("Report");
    Context := Target.CreateExecutionContext();
    Data := New Object[2];
    Data[0] := UiReportNet1.ReportUi.Report;
    Data[1] := "Abs";
    Context.Data := Data;
    If Convert.ToBoolean(Target.Execute("ShowFormulaDialog", Context, Null)) Then
        System.Diagnostics.Debug.WriteLine((Context.Data As Array)[1]);
    Else
        System.Diagnostics.Debug.WriteLine("Creating of the function is cancelled.");
    End If;
End Sub;

Clicking the button opens the functions wizard. The pointer is focused on the Abs function. The full text of the function is displayed in the development environment console after the function is created, and the OK button is clicked.

See also:

IUiCommandTarget.Execute