FastReport very slow in generating reports!
Hi
Please let me know what is the problem! I have a stored procedure work very fast, shows about 1000 rows in just less than a sec, but FastReport takes too long maybe 15 minutes to generate the report using the same stored procedure!
I call the report using a procedure (because I have more than 20 reports in my program I wrote a procedure to call a specific report), the procedure code is as bellow:
On the frmReport form I have frxReport1 and frxDBDataset1 only. the report file (fr3) is attached to this post and there is nothing complicated inside the report! a Master detail attached to frxDataset1.
when I call the ShowFastReport procedure it shows me a blank report and after about 1 minute it fills page 1 and so on.
p.s: I am new on fast report and want to migrate from crystal reports to fast report. I download VCL 5 for delphi 2010. MS SQL 2008 R2 database - Operating system: Windows 7 - 32bit - SP1
Regards
Please let me know what is the problem! I have a stored procedure work very fast, shows about 1000 rows in just less than a sec, but FastReport takes too long maybe 15 minutes to generate the report using the same stored procedure!
I call the report using a procedure (because I have more than 20 reports in my program I wrote a procedure to call a specific report), the procedure code is as bellow:
type
TReportParams = array [1 .. 100, 1 .. 2] of string ;
procedure ShowFastReport(ReportParam: TReportParams; ReportName: string; rptDataSource: TDataSource);
var
VIdx,
Count: integer;
Variable: TfrxVariable;
tmp: string;
begin
frmReport.frxReport1.Clear;
frmReport.frxReport1.LoadFromFile(ReportName);
if Software.DecimalQTY = 2 then
SetCrParam(ReportParam, 'DisplayFormat', '#,##0.00;(#,##0.00);-;-')
else
SetCrParam(ReportParam, 'DisplayFormat', '#,##0;(#,##0);-;-');
SetCrParam(ReportParam, 'CustomerName', ShowCompanyName);
SetCrParam(ReportParam, 'ReportName', ExtractFileName(ReportName));
SetCrParam(ReportParam, 'UserName', CRMUser.UserName);
SetCrParam(ReportParam, 'ReportDate', GetMessageBody(286) + CRMUser.GetDate);
SetCrParam(ReportParam, 'WebURL', 'RayaCRM3: www.rayacrm.com');
for Count := 1 to frmReport.frxReport1.Variables.Count do
begin
if ReportParam[Count, 1] <> 'nil' then
begin
VIdx := frmReport.frxReport1.Variables.IndexOf(ReportParam[Count, 1]);
if VIdx <> -1 then
begin
Variable := frmReport.frxReport1.Variables.Items[VIdx];
Variable.Value := QuotedStr(ReportParam[Count, 2]) ;
end;
end;
end;
frmReport.frxDBDataset1.DataSource := rptDataSource;
frmReport.frxReport1.ShowReport();
end;
On the frmReport form I have frxReport1 and frxDBDataset1 only. the report file (fr3) is attached to this post and there is nothing complicated inside the report! a Master detail attached to frxDataset1.
when I call the ShowFastReport procedure it shows me a blank report and after about 1 minute it fills page 1 and so on.
p.s: I am new on fast report and want to migrate from crystal reports to fast report. I download VCL 5 for delphi 2010. MS SQL 2008 R2 database - Operating system: Windows 7 - 32bit - SP1
Regards
Comments
Hi
Thanks for the reply.
I am not sure if I got your meaning by disable controls of data source, but let me explain, except the report I am trying to generate, there is a cxGrid bounds to the same data source, when user click on the create report button, I call the procedure mentioned in my previous post, after I read your reply I add a line of code to unbound the grid and then call the procedure but result is same!
See: http://docwiki.embarcadero.com/Libraries/X...DisableControls
If you do not want to loose time searching for slow code you can use a profiler.
Best regards,
Cristian Peta
after calling DisableControls result is same!
when user click on the Show Report button this code will call:
As you see in the ShowFastReport I called DisableControls before calling ShowReport and after that I called EnableControls. but the result is same! [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> I really confused! I think the coding has no problem, If I enter ADOQuery1.SQL.Text manually and run the preview from report designer in generate the reports really fast, but when I set SQL.Text property in runtime and open the query it does not work as expected. I attachec 3 pictures of the frxReport1, frxDatabase and ADOQuery1 properties. If you gays want to see the code and check it yourself you can connect my PC using TeamViewer. thanks in advance[/img]
Put a TDataSetProvider and a TClientDataSet between ADOQuery1 and frxDBDataSet1
ADOQuery1->DataSetProvider1->ClientDataSet1->frxDBDataSet1
And you will open ClientDataSet1
thanks for the reply
I will try it and let you know the result. I also decided to capture my screen and upload here to see how much slow it is!
I tried different ways and methods to resolve the problem but it seems there is something out of my control! With current method described on my last post (#7) it works great on windows 8 just 2-3 seconds to make the report but on windows 7 we have speed problem! 10-15 minutes to generate same report!
any suggestion?
Thank you for your reply,
Creating a small project on Access database using standard Delphi components will completely change the situation I am now involved with, with current database and components I've already used, program works fine on Windows 8 but on windows 7 it has speed problem! in the design reporter also there is no problem. even in windows 7, If i click on preview it generate report really quick(design time).
If you don't mind you can check the problem using team viewer.
For whom, they may face to similar problem, After upgrading to Windows 7 64bit the problem solved.