This is a migrated thread and some comments may be shown as answers.

Create IReportDocument Instance Object Performance Issue

2 Answers 122 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ajay Khedekar
Top achievements
Rank 1
Ajay Khedekar asked on 29 Jun 2009, 01:49 PM

Hello,

        I have a Report which has 5 Sub Reports and this sub reports has their own datasets.We are having Dataset(.XSD) files for Datasets. One of the Sub Report using Stored Procedure to get the data from database.
     
        I am using following code to Create IReportDocument object.

       

1. string

reportName = "MIDAS.Reporting.Calls.CallOutReport, MIDAS.Reporting, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";

 

 

2. IReportDocument objReportDoc;

 

3. Type

reportType = Type.GetType(reportName);

 

4. objReportDoc = (

IReportDocument)Activator.CreateInstance(reportType);

Here 4th point/line takes almoset 1 minute to Execute. Is it due to 5 subReports ? is there any other approach to improve the performance.

Any help would be highly appreciated.

Thanks in advance.

------------------------------------
Ajay



 

2 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 30 Jun 2009, 05:34 PM
Hi Ajay,

This is most likely to the large amounts of data that is being initialized for all 6 reports (1 main + 5 subreports). The only way to avoid that when invoking Activator.CreateInstance() is to move the binding logic from the report constructor to the processing i.e. using NeedDataSource event (also see bottom of this article).
This however would not improve the loading time for the report. If you're using our built-in report parameters, have in mind that the report retrieves the whole data first before filtering, so you might consider filtering on database level instead. Take a look at this video: Design Time Support for Parameterized Queries.

Sincerely yours,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Musa Kubheka
Top achievements
Rank 1
answered on 03 Jul 2009, 02:49 PM
Hi Ajay (or everybody),
I'm doing something similar to yours; Could you explain what the line
reportName = "MIDAS.Reporting.Calls.CallOutReport, MIDAS.Reporting, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
is for?

I have followed what you did but I get a null for reportType:
Type reportType = Type.GetType(ReportName); 
which then causes
reportDoc = (IReportDocument)Activator.CreateInstance(reportType);  
to break.

What I'm actually willing to achieve is to have a drop-down with a list of my reports; When a report is selected from a list, I just want to display it. Hence the code above.

I have created a class library for my reports (TelerikReportClassLib), which has 3 classes for now, named, Countries, Movies, Customers.
This is what is displayed in my drop-down list.

Thanks in advance
Musa

Problem solved:
The line reportName = "..." is loading (or embedding) a DLL dynamically.
  • MIDAS.Reporting.Calls.CallOutReport is the DLL name
  • MIDAS.Reporting is the name of the namespace

Tags
General Discussions
Asked by
Ajay Khedekar
Top achievements
Rank 1
Answers by
Steve
Telerik team
Musa Kubheka
Top achievements
Rank 1
Share this question
or