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

Reprint a report on column click

edited April 2004 in General
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

Comments

  • edited April 2004
    Hi,

    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;

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2004
    It works!

    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
This discussion has been closed.