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

An autosearch panel for two fields

edited May 2004 in End User
Hello,

I am using a customer AutoSearchPanel but I don't know how to use it to
modify two fields.

I need also to know
- How to mark the two fields in data Tab
- How to override TmyAutoSearchDialog.GetPanelClassForField. Now I am using


*****************************
if ( ( UpperCase(aField.FieldName) = 'TRLIN') and (aField.SearchOperator =
soEqual))
then
aPanelClass := TmyLineasSearchPanel;
*****************************

but I can only select a TppAutoSearchField.

- How to get the data of both fields to pass to the Custom
AutoSearchPanel.


Thanks,

Jose Maria Sanmartin

Comments

  • edited May 2004

    Okay, so now you are switching over to EndUser newsgroup from RAP. :)

    Sorry, I have not had time to research this one until now. Basically my
    approach to researching this is to trace the ReportBuilder source code while
    executing the Custom AutoSearch dialog example.

    Try the following approach:

    1. On the Data tab define the two autosearch criteria for the query.

    2. For the custom AutoSearchDialog override the TmyAutoSearchDialog.Init
    method to hide one of the panels. Here is my test code for modifying the
    TmyAutoSearchDialog example to hide the autosearch panel created for the
    SaleDate field.

    procedure TmyAutoSearchDialog.Init;
    var
    lAutoSearchGroups: TppAutoSearchGroups;
    lAutoSearchPanel: TppAutoSearchPanel;
    lAutoSearchField: TppAutoSearchField;
    begin

    inherited;

    lAutoSearchGroups := TppAutoSearchGroups(AutoSearchGroups);

    lAutoSearchField := lAutoSearchGroups[0].FieldsByName['SaleDate'];

    lAutoSearchPanel := TppAutoSearchPanel(lAutoSearchField.AutoSearchPanel);

    lAutoSearchPanel.Visible := False;

    end;


    3. In the OnGetSearchFieldValues event apply the search value entered for
    the first field to the sercond field.

    Report.AutoSearchFields[1].SearchExpression :=
    Report.AutoSearchFields[0].SearchExpression;


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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited May 2004
    Thanks, Nard

    I'll check it.

    Jose Maria Sanmartin
This discussion has been closed.