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

AutoSearchFields not getting applied to Report query

edited October 2001 in General
I have a report created in Report Explorer with an AutoSearchField on
PONumber. When printed/previewed from the Explorer, the Search Dialog pops
up and the user can enter the PO number, after which the correct PO prints.

To allow the user to directly print a PO from the app, I created a shortcut
button on the PO form of my app which creates a report object, loads its
template, sets the Expression of the AutoSearchField to the current PO
number, then prints the report. The Search Dialog pops up with the correct
PO appearing in the Search Field edit box, but when I click OK, ALL PO's get
printed, as if the Search criteria is not being applied to the report.

Here is the code snippet:

repMain.DeviceType := 'Screen';
repMain.FreeAutoSearchFields;
repMain.CreateAutoSearchField('POMN_Purchase_Order', 'POMN_PONumber',
'PO Number', dtString, soEqual, sPONumber, False);
repMain.Print;


The PO number specified in the string variable sPONumber in the
CreateAutoSearchField call is correctly appearing in the edit box of the
Search Dialog, so what do I need to do to get it to apply the search
criteria to the report's query.

TIA,

larry

Comments

  • edited October 2001
    There are examples of autosearch in your RBuilder\Demos\Enduser\Autosearch
    directory. If you have Autosearch criteria you would like to place on DADE
    queries, you should be able to use the Report.CreateAutoSearchCriteria
    method. If you have search fields you would like to apply to a report which
    uses a query object outside of DADE, then you'll want to use the
    CreateAutoSearchFields as you are doing. Also, there is an extensive
    explanation of using autosearch in the RBuilder help file. Check out
    Report.CreateAutoSearchFields and Report.CreateAutoSearchCriteria methods as
    well as the AutoSearchFields topics in the help.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.