Report Viewer export button load the data again

11 posts, 0 answers
  1. Peter
    Peter avatar
    20 posts
    Member since:
    Sep 2018

    Posted 09 Jul Link to this post

    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?
  2. Silviya
    Admin
    Silviya avatar
    394 posts

    Posted 15 Jul Link to this post

    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
    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
  3. Peter
    Peter avatar
    20 posts
    Member since:
    Sep 2018

    Posted 18 Jul in reply to Silviya Link to this post

    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?
  4. Silviya
    Admin
    Silviya avatar
    394 posts

    Posted 22 Jul Link to this post

    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
    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
  5. Peter
    Peter avatar
    20 posts
    Member since:
    Sep 2018

    Posted 26 Jul in reply to Silviya Link to this post

    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?

     

  6. Peter
    Peter avatar
    20 posts
    Member since:
    Sep 2018

    Posted 26 Jul in reply to Peter Link to this post

    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?
  7. Peter
    Peter avatar
    20 posts
    Member since:
    Sep 2018

    Posted 27 Jul in reply to Peter Link to this post

    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.

     

  8. Peter
    Peter avatar
    20 posts
    Member since:
    Sep 2018

    Posted 28 Jul in reply to Peter Link to this post

    Can I find the documentation for the report viewer web control?
  9. Neli
    Admin
    Neli avatar
    119 posts

    Posted 31 Jul Link to this post

    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
    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
  10. Peter
    Peter avatar
    20 posts
    Member since:
    Sep 2018

    Posted 31 Jul in reply to Neli Link to this post

    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?
  11. Neli
    Admin
    Neli avatar
    119 posts

    Posted 02 Aug Link to this post

    Hello Peter,

    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
Back to Top