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

Using AutoSearch

edited September 2003 in Server
In using the CreateAutoSearchField routines I get an access violation
when checking the modal result. The search comes up just fine with the
values and field as expected. And if the check is taken out the report
works. It looks like I need to know if the user canceled the request.

Please let me know if there is another way to check for a canceled
request or if there would be a different approach to the same end.

Thanks,
Dave


rocedure TLkrRptFrm.rbLockerCancelGetAutoSearchValues(Sender: TObject);
var
lAutoSearchField: TppAutoSearchField;
begin

{if user clicked 'Cancel' on dialog, exit}
if not(TppReport(Sender).AutoSearchDialog.ModalResult = mrOK) then Exit;

lAutoSearchField := TppReport(Sender).AutoSearchFields[0];
{if valid entry, get search expression in SQL format}
if not(lAutoSearchField.ShowAllValues) and (lAutoSearchField.Valid) then

TRxQuery(TppDBPipeLine(TppReport(Sender).DataPipeline).DataSource.DataSet).MacroByName('CLUBNO').AsString
:= lAutoSearchField.SQLString;
end;

Comments

  • edited September 2003
    I'm still digging into this problem and found that the report
    AutoSearchDialog for the report is nil and the OnAutoSearchDialogClose
    and the OnAfterAutoSearchDialogCreate events do not fire. So, who owns
    the dialog for the report? And what did it do with my data ;)

    Thanks,
    Dave


  • edited September 2003


    I assume that the code below is the server side code. Keep in mind that
    the AutoSearch dialog is shown by the ClientReport object executing on
    the client side. The ClientReport retrieves the autosearch parameters
    from the server, displays the dialog etc. When the report generates, the
    autosearch fields are sent from the client to the server and used in the
    report.

    For an example of a form based report with autosearch criteria check out
    RBServer\Demos\Server\Main - the form is dm0010.pas. Note that the
    events used are BeforeAutoSearchDialogCreate and GetAutoSearchValues.




    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited September 2003
    Oh, I did not see the search fields in dm0010.pas. So it is working as
    expected. Do I need code in the clent app to cancel a report from the
    autoseach dialog?

    Thanks,
    Dave


  • edited September 2003

    The ClientReport is designed to properly manage a Cancel from the
    autosearch dialog.





    Best regards,

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