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

Require at least one auto search parameter

edited March 2011 in End User
Delphi 2010
RB 12.02 Build 279

Is there any way to specify that at least one of multiple auto search
parameters is required, but not all of them are required? Basically we
have several reports that can be run by Customer # or Date Range. We
can't constrain the user to enter both parameters, but we need to
require that at least one of them is entered b/c if they accidentally
run the report without entering either of the search parameters it can
bring the whole system to a crawl while the DB is returning every record
in existence.

What is the best way to achieve this?

--
Regards,
Branden Johnson
Integrity Software Design

Comments

  • edited March 2011
    Hi Branden,

    Setting the Mandatory property to True for each AutoSearch field will
    ensure that your user(s) enter a value before running the report. It
    would also be possible to create a custom AutoSearch dialog that
    determines if only one value has been entered. Setting both search
    values to Mandatory will require that both are entered.


    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2011
    On 3/29/2011 9:20 AM, Nico Cizik (Digital Metaphors) wrote:


    --
    Regards,
    Branden Johnson
    Integrity Software Design
  • edited March 2011
    Take a look at the current AutoSearch dialog and see how it verifies
    that valid entries have been made. I believe it checks the
    AutoSearchField.Mandatory property. It should not be very hard to alter
    this to accept the criteria if only one field is defined.


    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2011
    That seemed a little too convoluted for what I am trying to do. I can
    add the code to The OnAutoSearchDialogClose event to check first if
    there are auto search parameters and second if at least one of them is
    populated. My only problem is that this event is called even if the
    user clicks "Cancel". How can I know from code (Delphi code, not RAP)
    within the OnAutoSearchDialogClose that the user clicked cancel instead
    of OK?


  • edited April 2011
    Try checking the Report.AutoSearchDialog.ModalResult property.

    if myReport.AutoSearchDialog.ModalResult = mrOK then
    // use pressed ok
    else
    // user pressed cancel




    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2011
    Thank you for the quick response and I apologize for my hasty post. I
    realized the solution a few minutes after posting.

This discussion has been closed.