Reprint a report on column click
Hello,
I have a Reportbuilder report that shows data in columns. Now I would like
to give the user the option to order on a different column, when he clicks
on the column title. This re-ordering happens by restarting the query with a
different 'order by' clause.
So I have created until now the following DrawCommandClick event handler:
procedure TrepMessagesResult.ppLabel5DrawCommandClick(Sender,
aDrawCommand: TObject);
begin
inherited;
qryMessageResults.Close;
OrderQueryBy(qryMessageResults, 'MR.ReadyCount');
qryMessageResults.Open;
// now do something to restart the report printing?
???
end;
I tried things like: ppReport1.Reset; ppReport1.Print;
And: TppViewer(ppReport1.PreviewForm.Viewer).RegenerateReport;
But I can't get it to work. What is the magic word here?
Regards,
Tjipke van der Plaats
I have a Reportbuilder report that shows data in columns. Now I would like
to give the user the option to order on a different column, when he clicks
on the column title. This re-ordering happens by restarting the query with a
different 'order by' clause.
So I have created until now the following DrawCommandClick event handler:
procedure TrepMessagesResult.ppLabel5DrawCommandClick(Sender,
aDrawCommand: TObject);
begin
inherited;
qryMessageResults.Close;
OrderQueryBy(qryMessageResults, 'MR.ReadyCount');
qryMessageResults.Open;
// now do something to restart the report printing?
???
end;
I tried things like: ppReport1.Reset; ppReport1.Print;
And: TppViewer(ppReport1.PreviewForm.Viewer).RegenerateReport;
But I can't get it to work. What is the magic word here?
Regards,
Tjipke van der Plaats
This discussion has been closed.
Comments
Refreshing the report at runtime from the preview is very similar to using
the AutoSearch feature. Once your data has been changed in your database,
be sure your datasets are active, then reset the Report and the
Report.Engine in that order. Then you can call RegenerateReport and the new
data should show up. Something like the following...
ppReport1.Reset;
ppReport1.Engine.Reset;
TppViewer(ppReport1.PreviewForm.Viewer).RegenerateReport;
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
But... now I get access violations the second time I click on a column...
(using RB 7.03 according to the help, about in the designer).
I will see if I can get more info on that, but it seems to be in List.Get.
Further it is a very simple report.
Any hints?
Tjipke
--
Want to update version information in your project from the command line?
Use ChangeRes! See: http://www.tiriss.com/changeres