Interactive report
Hi,
Is it possible to create the following interactive report.
I would like to give te user the possibility to change the order of
displayed data by clicking on a header label. I can code the
OnDrawCommandClick() like this:
var lSQLBuilder : TdaSQLBuilder;
begin
lSQLBuilder := TdaSQLBuilder.Create(Report.DataPipeline);
lSQLBuilder.OrderByFields.Items[0].Ascending := not
lSQLBuilder.OrderByFields.Items[0].Ascending;
lSQLBuilder.Free;
{ reset report engine }
end;
Can I get the report engine to draw the report again using the new DADE
settings?
Regards,
Jeroen R?ttink
Is it possible to create the following interactive report.
I would like to give te user the possibility to change the order of
displayed data by clicking on a header label. I can code the
OnDrawCommandClick() like this:
var lSQLBuilder : TdaSQLBuilder;
begin
lSQLBuilder := TdaSQLBuilder.Create(Report.DataPipeline);
lSQLBuilder.OrderByFields.Items[0].Ascending := not
lSQLBuilder.OrderByFields.Items[0].Ascending;
lSQLBuilder.Free;
{ reset report engine }
end;
Can I get the report engine to draw the report again using the new DADE
settings?
Regards,
Jeroen R?ttink
This discussion has been closed.
Comments
Try setting the RedrawPage property of the drawcommand to True. This is how
ReportBuilder refreshes the data after an AutoSearch value is entered.
uses
ppDevice;
TppDrawCommand(aDrawCommand).RedrawPage := True;
Note: RedrawPage is included in the TppDrawCommand RAP RTTI so it should
function correctly in RAP.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I added the statement but nothing seems to change...
Regards,
Jeroen.
Sorry, I failed to give you the entire solution.
You will need to reset the report and report engine before setting the
RedrawPage property to true. Unfortunately I do not believe the reset
routine is natively available in RAP so this will need to be done in a
pass-thru function.
Report.Reset;
Report.Engine.Reset
TppDrawCommand(aDrawCommand).RedrawPage := True;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I am afraid even with these statements called, the result is stil the same.
Regards,
Jeroen.
I created a small example that does this in RAP for you. It looks like you
need to add TdaSQLBuilder.ApplyUpdates before you free the object, and you
need to set the RedrawPage property in the pass-thru function. Hope this
helps.
http://www.digital-metaphors.com/tips/RefreshReportAfterDataChangeRAP.zip
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Thanks. Now it all works. I did already call ApplyUpdates() but I called
RedrawPage from RAP instead of from the pass-thru function. Btw: Why is that
not working?
Another thing I came across is I don't get a compile error on the following
RAP statement:
ResetReportEngine(Report, aDrawCommand);
But in the pass-thru function aDrawCommand is nil. If the statement is:
ResetReportEngine(Report, TppDrawCommand(aDrawCommand));
everything works as expected.
Regards,
Jeroen.
I'm glad you got it working. I'm unsure why you are getting a compile error
when using the example. It seems to work correctly for me. The signature
for the pass-thru function asks for a TppDrawCommand object so it should
only work correctly the way I have it set up.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I happy too. Opens up alot of new possibilities.
I think you misread the last post. I don't get a RAP compile error while I
was expecting one. I pass a TObject object but the signature needs a
TppDrawCommand.
The other question is why the RAP version of RedrawPage() doesn't do the
trick.
Regards,
Jeroen.
Ah, yes I did misread your post. It looks as though it does not cause an
error just as long as the descendent is the same. I suppose Delphi is
letting us get away with something there.
I'm not sure why the RedrawPage command is not functioning when called from
RAP. I assume it has something to do with the timing it is called with
respect to the other reset calls. I'll research adding those calls to RAP
and see if that solves the problem.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com