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

Using a single AutoSearch field multiple times

edited September 2006 in General
Ok, what I need to do is use a single AutoSearch field, entered by the
user when the report is run, multiple times within the search
criteria.

For example, say I was retrieving a list of orders and I wanted to
display any order which had been delivered or invoiced prior to a
given date. I can setup two criteria like so:

Orders.InvoicedDate < []
OR
Orders.DeliveredDate < []

Where [] denotes a blank expression which will be filled in at
runtime.

Now if I mark each of these as AutoSearch then when the report is run
the user has to enter the same date twice, which is hardly ideal.

What I really want is to enter a single date and then use it in each
of the two search expressions. How can I do this?

I can intercept the OnGetAutoSearchValues but all that's available to
me are the AutoSearch fields. What I need is to mark only the first
of the two criteria as AutoSearch and then, in this handler, copy the
expression entered by the user into the expression of the second
criteria. Unfortunately, if the second criteria isn't marked as
AutoSearch then it's unavailable to me, isn't it?

What would be most useful is some way of configuring my own variables
within the report which I could give a description to and mark as
AutoSearch so they were included on the AutoSearchDialog, along with
the specified description. I would then be able to specify these
variables in place of the expression field for any criteria I wished.

Can anyone help me with this, as I just can't see a way of achieving
it.

Many thanks,
--
Toby.

Comments

  • edited September 2006
    Hi Toby,

    If you are using DADE to create your queries, I would recommend using the
    TdaSQLBuilder class to alter your search criteria at runtime based on a
    user's single autosearch entry. Using the TdaSQLBuilder you are able to
    easily create, edit, and add search criteria on the fly at runtime. Take a
    look at the TdaSQLBuilder topic in the RBuilder help for more information
    and examples.

    If you are not using DADE, take a look at the AutoSearch examples located in
    the Demos directory. These examples show how to create an AutoSearch field
    in code and assign it's value. It is not required to ask the user for a
    value for each autosearch field created.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2006
    On Tue, 12 Sep 2006 13:00:30 -0600, "Nico Cizik \(Digital Metaphors\)"
  • edited September 2006
    Hi Toby,

    ReportBuilder does not have any built-in feature to handle this type of
    autosearch however it is possible to replace the native autosearch dialog
    with one of your own. This would allow you to handle the user input however
    you would like. Take a look at the custom autosearch demo in the same
    directory.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.