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

Help in adding a AutoSearchField

edited July 2004 in RAP
I have a master and two detail queries in the data tab and each detail
query is using the same table as part of the selection. There a
AutoSearchField on on detail that I would like to add to the second
detail query. So the user is prompted only once for the date range.

I've tried the code with OnGetAutoSearchValues and
OnAutoSearchDialogClose without success.
var
MyString,
begDate,
endDate : String;
begin
MyString :=
Report.AutoSearchCriteriaByName('Sales','mvare_timestamp').searchExpression;
begDate := copy(MyString,1,pos(',',MyString)-1);
endDate := copy(MyString,pos(',',MyString)+1,length(MyString));
Report.CreateAutoSearchCriteria('Redeemed', 'mvare_timestamp',
soBetween, MyString, False);

The data showing is all in the table, so the autosearch does not take
effect.

Is there a better way to add the search field through RAP?

Dave

Comments

  • edited July 2004

    I think the issue here is that it is too late to add autosearch criteria -
    the autosearch dialog has already been displayed.

    I think you want to define the second search criteria using the Query
    Designer and define it as AutoSearch = False. Then in the
    OnGetAutoSearchValues, extract the SQL object and specify the search value
    for the non-autosearch criteria.

    Check out the following example....

    www.digital-metaphors.com/tips/OneAutoSearchCriteriaToMany.zip

    --


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited August 2004
    Nard,
    I've finally the time to get back to this report and my problem is
    that this is a ReportBuilder Server rtm report and there is not a form
    to add a procedure for this event. Is there any way to use the
    AutoSearch values from one dataview in another dataview with the same
    columns, just a different view of data from the same tables.

    Once again, I have three dataviews. One master and two details,
    where the details are very similar and need the same date range. I
    would like to only prompt once for the date range.

    If I put the table with the date ranges then the two details do not
    show the fields needed to link. Just the one field from another table
    needed for the link.

    I'm getting desperate here, so any suggestions would be helpful.

    Thanks,
    Dave


  • edited August 2004

    Here is an example of a report that contains a custom query and two detail
    queries on orders. The first orders query contains an autosearch criteria on
    SaleDate, the second query contains an a search criteria (but not
    autosearch) on SaleDate. The autosearch dialog displays a single date range.
    The date range is applied automatically to the first detail query and
    programmatically to the second detail query.

    This example uses Delphi code to implement a Report.OnGetAutoSeachValues
    event-handler that calls a utility function.

    This solution could be could be re-implemented to use RAP by converting the
    utility function to a RAP pass-thru function.

    www.digital-metaphors.com/tips/DadeOneAutoSearchToTwoDetail.zip




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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.