Print Page | Close Window

Very Slow Crystal Report display

Printed From: Crystal Reports Book
Category: General Information
Forum Name: Announcements
Forum Discription: Please check this section for the latest announcements from Crystal Reports Forum
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=7642
Printed Date: 14 May 2024 at 11:23am


Topic: Very Slow Crystal Report display
Posted By: sharad_memory
Subject: Very Slow Crystal Report display
Date Posted: 09 Sep 2009 at 11:12pm
Hi,
 I am using CrystalReport11-R2 in my application. I have uses A DataTable of Typed Dataset as DataSource. I have used querries in front end the querry returns a DataTable. This DataTable has been added in DataTable of TypedDataSet. Like;
 
ReportDocument rptdmt=new ReportDocument();
string FileName=Application.StartupPath+ file://\\report1.rpt - \\report1.rpt ;
rptdmt.Load(FileName);
 
strring querry="Select values from tableName";
DataTable dt=DA.ExecuteDataTable(querry);
 
Myapp.DataSet1.DataTable1 dtReport=new Myapp.DataSet1.DataTable1();
foreach(DataRow dr in dt..Rows)
{
    dtReport.Add(dr.ItemArray);
}
 
rptdmt.SetDataSource(dtReport)
 
crViewer.ReportSource=rptdmt;
 
 
This is pattern of my codeing for displaying report. The data are correctly displayed. My only problem is report is displayed after long time which is very slow in my application. Please advice me how can speed up my report display?


-------------
sharadchandra



Replies:
Posted By: hilfy
Date Posted: 10 Sep 2009 at 9:33am
There are a couple of things that will affect this.
 
1.  The first time that you run a report in your application, all of the Crystal assemblies that are required for processing the report are loaded into memory.  This takes a while and there's not much you can do speed it up other than adding more memory to the workstation where the report is being run.
 
2.  If possible, compile the report into your application rather than loading it from a file.  My experience has been that it takes less time to create a typed object for a specific report than it does to load it from a file.  If you want your users to be able to modify the reports or if you want to be able to distribute report updates without updating the software, you will not be able to do this.
 
3.  Do all of your data filtering in your application BEFORE you set the data source for your report.  When you're working with in-memory data sets, you don't have a database server to do filtering and grouping for you, so Crystal has to read ALL of the data and do the filtering and grouping as it's processing the data, so it takes much longer than having the database do the work.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: sharad_memory
Date Posted: 10 Sep 2009 at 8:27pm

hilfy,

-yes it may be due to loading of Crsytal Reports Assembly in the time of displaying report first time. I tried to load assemblies in the starting of application and used its object for further time. It worked for one report. If the next report is tried to view without restarting the application the object reference exception is thrown. If new object is created it works.
 
-In my application crystal report need not process any querries. All the datas are filtered in the application. Filtered datas are taken initially in the form of dataTable. This DataTable is just added in Typed DataSets DataTable. In my application there is not relation of Crystal report with database.
 
Still there is delay in displaying report. How to solve this please suggest me.


-------------
sharadchandra


Posted By: hilfy
Date Posted: 10 Sep 2009 at 8:52pm
How many rows of data?  Is there more than one table?  If so, how many rows in the joined data?  Is your data already sorted or is Crystal sorting it?  Are you doing any summaries (sum, count, etc.?)
 
To prevent the exception, you need to be sure to explicitly call dtReport.Dispose() when the user is done with the report - usually in the OnClosing event handler of the viewer form, but that depends on your code.  The Crystal assemblies are wrappers around COM objects.  .NET memory management does not work well with COM objects so they always have to be explicitly disposed. 
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window