I have a report viewer in reportviewer.aspx. After I generated the report, I chose Excel format and click Export. I found that in backend, when I press the export button, it goes to load the data again and it make export take 20 minutes or more. I am doubting whether the export is just dumping the already generated report content or will load the functions and do the calculation once again. How can I avoid the export to do the calculation again but just dumping the already generated report?
10 Answers, 1 is accepted
0
Hello Peter,
The Reporting REST service does not cache the processed report, but the rendered report: Cache Management. When a report is requested in other format than the required for the viewer, the report is re-processed which will lead to re-executing the data retrieval methods. Thus it is guaranteed the report will reflect the latest changes in the data.
You could avoid querying again the data by caching it in memory via custom logic. For example, once you have the data, you can store it in a custom storage by key. Then on consecutive requests for the same report with the same key, you can load the already stored data instead of re-retrieving it from the source.
Best Regards,
Silviya
Progress Telerik
The Reporting REST service does not cache the processed report, but the rendered report: Cache Management. When a report is requested in other format than the required for the viewer, the report is re-processed which will lead to re-executing the data retrieval methods. Thus it is guaranteed the report will reflect the latest changes in the data.
You could avoid querying again the data by caching it in memory via custom logic. For example, once you have the data, you can store it in a custom storage by key. Then on consecutive requests for the same report with the same key, you can load the already stored data instead of re-retrieving it from the source.
Best Regards,
Silviya
Progress Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
Peter
Top achievements
Rank 1
answered on 19 Jul 2019, 04:40 AM
I am using asp.net web control report viewer. How can I handle the storage to make the export fast and no need to query the data again?
0
Hello Peter,
The processed document is not persisted in memory when exporting/printing. That's why the report is processed every time when it's requested in other format. If we've decided to cache the processed data, we would quickly run out of memory.
In this scenario I can suggest to implement a simple caching that will return the same data by given set of parameters. The sample steps to create such caching mechanism are listed below:
1. Use an ObjectDataSource in your report instead of SqlDataSource or WebServiceDataSource, because the last two rely on direct connection to a database or service and will always fetch the data. The ObjectDataSource's data retrieval method will accept a a given set of parameters as its arguments and will return a result set - DataTable or a collection of business objects.
2. Create a simple dictionary that will store the data for such given set of parameters.
3. In the ObjectDataSource data retrieval method check if the dictionary already contains data for the passed parameters. If the result set is found in the dictionary, return it. If it is not found, get it from the database and store it in the dictionary for future use.
This simple caching will ensure the data will be fetched only once for the same set of parameters, so when you export the report with the same set of parameters, this cache will be hit and there will be no delay caused by obtaining the data from the data sources.
Best Regards,
Silviya
Progress Telerik
The processed document is not persisted in memory when exporting/printing. That's why the report is processed every time when it's requested in other format. If we've decided to cache the processed data, we would quickly run out of memory.
In this scenario I can suggest to implement a simple caching that will return the same data by given set of parameters. The sample steps to create such caching mechanism are listed below:
1. Use an ObjectDataSource in your report instead of SqlDataSource or WebServiceDataSource, because the last two rely on direct connection to a database or service and will always fetch the data. The ObjectDataSource's data retrieval method will accept a a given set of parameters as its arguments and will return a result set - DataTable or a collection of business objects.
2. Create a simple dictionary that will store the data for such given set of parameters.
3. In the ObjectDataSource data retrieval method check if the dictionary already contains data for the passed parameters. If the result set is found in the dictionary, return it. If it is not found, get it from the database and store it in the dictionary for future use.
This simple caching will ensure the data will be fetched only once for the same set of parameters, so when you export the report with the same set of parameters, this cache will be hit and there will be no delay caused by obtaining the data from the data sources.
Best Regards,
Silviya
Progress Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
Peter
Top achievements
Rank 1
answered on 26 Jul 2019, 08:16 AM
Thanks Silviya. But I found sometimes when I export the excel format of report. It does not query the database. It just export instantly. But for most times, it will query again. Is that any setting that can be set in report viewer web control to allow the instant export of excel sheet?
0
Peter
Top achievements
Rank 1
answered on 26 Jul 2019, 08:58 AM
I found that if I do the export to excel immediately after the report is generated. The export file will be produced immediately. Is that any setting in telerik report config section about the timeout for the generated report to be export immediately?
0
Peter
Top achievements
Rank 1
answered on 27 Jul 2019, 08:34 AM
It seems the processed data is retained for about 5 minutes. Within this 5 minutes, I can export the excel instantly and the report viewer did not go to query the backend. I am just wondering is there any setting to adjust the retaining time of data.
0
Peter
Top achievements
Rank 1
answered on 29 Jul 2019, 03:06 AM
Can I find the documentation for the report viewer web control?
0
Hello Peter,
When you export the report the viewer, the ReportSharingTimeout starts to expire. That's the time in minutes indicating how long a rendered report document from a client will be viable for reuse on subsequent document requests from the same or other clients. The reason for the report document to expire with the sharing timeout is that if the data for the report is updated after displaying the report, and you try to export the report, the reporting engine will fetch the updated data and the exported report will differ from the displayed one. If the time hasn't expired, the report will be taken from the REST Service storage. However, the request from the viewer to the service will be made. There will be no data queries though, as the report will not be processed (e.g. if you export the same report with the same parameter values in the same format).
You can set the property, which value has to be greater or equal to zero. A zero value will prevent rendered report document reuse, e.g. the report will be processed again on each request/export.
Further details on the communication between the viewer and the service can be found in HTML5 Report Viewer and Reporting REST services article.
Regards,
Neli
Progress Telerik
When you export the report the viewer, the ReportSharingTimeout starts to expire. That's the time in minutes indicating how long a rendered report document from a client will be viable for reuse on subsequent document requests from the same or other clients. The reason for the report document to expire with the sharing timeout is that if the data for the report is updated after displaying the report, and you try to export the report, the reporting engine will fetch the updated data and the exported report will differ from the displayed one. If the time hasn't expired, the report will be taken from the REST Service storage. However, the request from the viewer to the service will be made. There will be no data queries though, as the report will not be processed (e.g. if you export the same report with the same parameter values in the same format).
You can set the property, which value has to be greater or equal to zero. A zero value will prevent rendered report document reuse, e.g. the report will be processed again on each request/export.
Further details on the communication between the viewer and the service can be found in HTML5 Report Viewer and Reporting REST services article.
Regards,
Neli
Progress Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
Peter
Top achievements
Rank 1
answered on 31 Jul 2019, 10:48 AM
Thanks Neli, as I am using report viewer web control. Is that possible I can set the ReportSharingTimeout value. If so, is that I am going to set in the <telerik.reporting> section?
0
Hello Peter,
As you correctly assumed, the ReportSharingTimeout value has to be set in Telerik.Reporting configuration section. For example:
Regards,
Neli
Progress Telerik
As you correctly assumed, the ReportSharingTimeout value has to be set in Telerik.Reporting configuration section. For example:
<
configuration
>
<
section
name
=
"Telerik.Reporting"
type
=
"Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting, Version=x.x.x.x, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"
allowLocation
=
"true"
allowDefinition
=
"Everywhere"
/>
</
configSections
>
<
Telerik.Reporting
>
<
restReportService
workerCount
=
"3"
clientSessionTimeout
=
"15"
reportSharingTimeout
=
"0"
/>
</
Telerik.Reporting
>
</
configuration
>
Regards,
Neli
Progress Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items