rsClientReport1 ReceiveAutoSearchFields does not fire
when I try the a the report with the ppReport in the same exe things work
fine.
procedure TForm1.FormCreate(Sender: TObject);
begin
{ ppReport1.ShowAutoSearchDialog := False;}
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
ppReport1.Reset;
ppReport1.Print;
end;
procedure TForm1.ppReport1GetAutoSearchValues(Sender: TObject);
begin
ppReport1.AutoSearchFields[0].SearchExpression := '259';
end;
however when i use the rbServer and the rsClientReport it doesn't.
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
rsClientReport1.ShowAutoSearchDialog := False;
rsClientReport1.VolumeName := 'Examples';
rsClientReport1.ReportName := 'Invoice';
rsClientReport1.Print;
end;
procedure TForm1.rsClientReport1ReceiveAutoSearchFields(Sender: TObject);
begin
rsClientReport1.AutoSearchFields[0].SearchExpression := '259';
end;
Any suggestions?
Kind Regards,
Olivier Peter.
fine.
procedure TForm1.FormCreate(Sender: TObject);
begin
{ ppReport1.ShowAutoSearchDialog := False;}
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
ppReport1.Reset;
ppReport1.Print;
end;
procedure TForm1.ppReport1GetAutoSearchValues(Sender: TObject);
begin
ppReport1.AutoSearchFields[0].SearchExpression := '259';
end;
however when i use the rbServer and the rsClientReport it doesn't.
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
rsClientReport1.ShowAutoSearchDialog := False;
rsClientReport1.VolumeName := 'Examples';
rsClientReport1.ReportName := 'Invoice';
rsClientReport1.Print;
end;
procedure TForm1.rsClientReport1ReceiveAutoSearchFields(Sender: TObject);
begin
rsClientReport1.AutoSearchFields[0].SearchExpression := '259';
end;
Any suggestions?
Kind Regards,
Olivier Peter.
This discussion has been closed.
Comments
the values are stuffed into the Autosearch Expression. (debug this by
leaving autosearch := true)
In the OnReceiveAutoSearchFields Event of the rsClientReport I have the
following code
with (Sender as TrsClientReport) do
begin
ShowAutoSearchDialog := false;
for i:= 0 to AutoSearchFieldCount - 1 do
begin
if (AutoSearchFields[i].FieldName = 'TPTN_DIST_NB') then
AutoSearchFields[i].SearchExpression := '9';
end; // for
PrintToDevices;
end; // with
Hope this helps...
Jon Gray
AutoSearch works a littel differently with ClientReport than with
Report. The first time you call Print, a request is sent to the server
to execute the report. If the report has autosearch fields, then the
fields are returned to the client and the
ClientReport.OnReceiveAutoSearch fields event fires. You can use the
event-handler to set the search values and can optionally suppress the
dialog. If you suppress the search dialog, then you need to call
PrintToDevices to send the search values to the server. The server will
execute the report and respond with the requsted page or pages.
I modified the RBServer\Demos\Clients\02. Client Report example as shown
below and it works as expected. I used the main demo server for the
test. Following the example code is an article that I posted to a
similar thread yesterday.
Example Code:
procedure TfrmClientReport.btnPrintClick(Sender: TObject);
begin
rsClientReport1.VolumeName := 'Report Forms';
rsClientReport1.ReportName := 'AutoSearch\Biolife Table';
rsclientReport1.Print;
end;
procedure
TfrmClientReport.rsClientReport1ReceiveAutoSearchFields(Sender:
TObject);
begin
{set the search values that have been received from the server}
rsClientReport1.AutoSearchFields[0].ShowAllValues := False;
rsClientReport1.AutoSearchFields[0].SearchExpression := 'C';
{suppress the autosearch dialog and send the search values to the
server}
rsClientReport1.ShowAutoSearchDialog := False;
rsClientReport1.PrintToDevices;
end;
-------------------------------------------
ClentReport: Customizing AutoSearch
-------------------------------------------
There are two approaches to customizing autosearch when using the
ClientReport component.
a. Customize the built-in autosearch dialog in the same manner as
applies to a standard TppReport (see RBuilder\Demos\AutoSearch\Custom
AutoSearch Dialog).
b. Use the ClientReport.OnReceiveAutoSearchFieldsEvent. This event fires
when the client report receives autosearch fields from the server. In
the event-handler, you can programmatically set the search values. You
can optionally set ShowAutoSearchDialog to False to suppress the
autosearch dialog and then call PrintToDevices to send the autosearch
values to the server.
example:
procedure ClientReport1ReceiveAutoSearchFields
ClientReport1.AutoSearchFields[0].ShowAllValues := False;
ClientReport1.AutoSearchFields[0].SearchExpression := 'A';
{optional code to suppress the autosearch dialog and generate the
report}
ClientReport1.ShowAutoSearchDialog := False;
ClientReport1.PrintToDevices;
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com