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

Passing a value to Autosearch

edited June 2008 in General
In my application, the current record's "customer number" is always required for reports, and is the only autosearch
field defined for all reports. Thus, I would like it populated by default with the current customer number.

What is the simplest way to do this?

Thanks for any clues! I've tried all kinds of things in "AfterAutoSearchDialogCreate" which don't seem to do the trick.

Lastly, if I eventually do not want to display the AutoSearchDialog, (report.ShowAutoSearchDialog = False) since the
parameter would effectively be passed transparently, I would assume the AutoSearchDialog is not created?

John

Comments

  • edited June 2008
    Hi John,

    Try using the Report.OnGetAutoSearchValues event to assign a value to an
    autosearch field. From there you can either create a new autosearch field
    (using the Report.CreateAutoSearchCriteria() routine) or you can access any
    existing autosearch fields using the AutoSearchCriteriaByName or
    AutoSearchFields[] list.

    If you are using DADE, I would strongly recommend using the TdaSQLBuilder
    class to create and manage your search criteria in code. Take a look at the
    TdaSQLBuilder topic in the RBuilder help for more information and code
    examples.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2008
    Nico,

    Thanks for the help.

    I used "report.autosearchfields[0].SearchExpression := TablePersistentFieldname.value;"

    in the OnGetAutoSearchValues event, and all is working fine.

    Thanks again,

    John
This discussion has been closed.