PerformSearch Command

Purpose

Opens a standard dialog box that is used to find or replace an object in 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:  ITabCellSearch The object that contains search parameters to be set in the dialog box.
Element 2: Boolean The parameter determines, which tab is to be active when the dialog box opens. The Replace tab is active when True value is passed, otherwise the Find tab is active. Optional parameter, the default value is False.
Element 3: TabCellSearchTarget The parameter that specifies which cell properties will be available for search in the Search Object section in advanced settings. Optional parameter, all cell properties are available by default.
Element 4: TabFindReplaceFormat The parameter determines whether it is possible to set format for the text to be found or replaced.
Optional parameter, by default, the format can be set both for the text to be searched and the text, which will replace it.

Application Features

The command can be used only for regular reports.

Example

Executing the example requires a form, the Button1 button on this form, the ReportBox component, and the UiReport component named UiReport1, which is used as a data source for ReportBox.

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        Target: IUiCommandTarget;
        Context: IUiCommandExecutionContext;
        Data: Array;
        CellSearch: ITabCellSearch;
    Begin
        Target := WinApplication.Instance.GetPluginTarget("Report");
        Context := Target.CreateExecutionContext;
        CellSearch := ((UiReport1.Instance As IPrxReport).ActiveSheet As IPrxTable).TabSheet.CreateCellSearch;
        Data := New Variant[4];
        Data[0] := CellSearch;
        Data[1] := False;
        Data[2] := TabCellSearchTarget.Formula Or TabCellSearchTarget.Text;
        Data[3] := TabFindReplaceFormat.Find;
        Context.Data := Data;
        Target.Execute("PerformSearch", Context);
    End Sub Button1OnClick;

Clicking the button opens a standard dialog box to find or replace objects in a regular report.

See also:

IUiCommandTarget.Execute