Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Selectively show some AutoSearch fields in dialog

edited October 2001 in General
Is there a way to show *some* fields defined as Autosearch fields in the
autosearch dialog, but not others. For example, I already have the app set
up to automatically (programmatically) fill in the values for two specific
fields if the end user selects them as autosearch fields. But any other
selected autosearch fields I'd like to be displayed for the user to enter.
Is this possible?

Thanks,
Vinnie Murdico

Comments

  • edited October 2001
    Use the Report.AutoSearchFields property.

    When ShowAutoSearchDialog is True, the AutoSearchFields are used to
    configure the AutoSearchDialog and to store the results of the search
    criteria entered into this dialog. In ReportBuilder Professional and
    Enterprise, query-based dataviews in the data workspace utilize this
    capability to provide a built-in way for developers and end users to specify
    search criteria to be displayed before a report is generated.

    When ShowAutoSearchDialog is False, you can use AutoSearchFields to manually
    assign the search criteria values to be used by the report. In this
    scenario, the values are assigned before calling the Report.Print method.
    If you have used the data workspace in ReportBuilder to create the
    AutoSearchFields, then the search criteria values will automatically be used
    by the query-based dataview. If you are using ReportBuilder, then it is up
    to you to assign the search criteria values to the actual data access
    components being used by the report. This can be done in the
    OnGetAutoSearchValues, an event which fires whenever AutoSearchFields exist,
    regardless of whether the AutoSearchDialog was displayed.

    For instance, let's say you want to display the AutoSearchDialog for one
    user, but for another you want hide the dialog and need to assign the search
    criteria values 'under the covers'. In order to do this, first create an
    OnGetAutoSearchValues event handler. This event handler should assign the
    search criteria values from the AutoSearchFields to the appropriate data
    access components for the report. Next, code an event handler that will
    create the AutoSearchFields. You can use either the OnCreate event of the
    form containing the report or simply place the code before the call to the
    Print method. This event handler should create the AutoSearchField
    components (the easiest way to do this is to call the
    Report.CreateAutoSearchField method).

    Once you have completed these steps, you have an implementation that can
    work two ways depending on the value of the ShowAutoSearchDialog property.
    If you set ShowAutoSearchDialog to True, the dialog will be displayed when
    the Report.Print method is called and the values entered into the dialog
    will then be assigned to the appropriate data access components via the
    OnGetAutoSearchValues event handler. If you set ShowAutoSearchDialog to
    False, manually set the AutoSearchField values in code and then call Print,
    then the dialog will not be displayed, but the values will still be
    transferred to the data access components via OnGetAutoSearchValues. This
    allows you to write one procedure for transferring the AutoSearchField
    values to the data access components, while providing for multiple sources
    for the actual search criteria values.

    For an example of how to use the AutoSearch dialog, see the example projects
    in the ...RBuilder\Demos\AutoSearch directory.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.