Using AutoSearch
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;
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;
This discussion has been closed.
Comments
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
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
expected. Do I need code in the clent app to cancel a report from the
autoseach dialog?
Thanks,
Dave
The ClientReport is designed to properly manage a Cancel from the
autosearch dialog.
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com