HTML 5 Report Viewer Web Api - Report not refreshing

2 posts, 0 answers
  1. Colin
    Colin  avatar
    18 posts
    Member since:
    Aug 2014

    Posted 20 Apr 2015 Link to this post

    I have a Web Api project with Telerik reporting, and a client Angular site that hosts the reportviewer.

    The reports are triggered by a button on the angular app, which opens a new window which hosts the reportviewer, 

    The initial call to the report Web Api works as expected, the data is read from the database using an object datasource and the report is displayed.

    If I then change the values in the database and click the browser refresh button, or the button that fired the report, I get the report with the old values being displayed. I have also tried modifying the report by adding new labels, recompiling the Wep Api project and refreshing, but I still get the old report showing.

    If I click the refresh button on the report viewer, the report is refreshed correctly. 

    I initially thought this may have something tho do with the ReportsController in the Web Api as described in this thread, but I have the same symptoms irrespective of whether I override CreateCache with a File case or a database cache, or override CreateStorage with a MsSqlServerStorage.

    I ran a Fiddler trace and noticed that when I clicked the report button a second time (or clicked the browser refresh button) the call to 

    GET /api/reports/clients/114416-a7b5/instances/112216-ebd8/documents/113600-3f1a113600-57c1/info returned

        "documentReady": true,
        "pageCount": 1,
        "documentMapAvailable": false,
        "bookmarkNodes": null

    and when I clicked the refresh button on the report viewer it returned

        "documentReady": false,
        "pageCount": 0,
        "documentMapAvailable": false,
        "bookmarkNodes": null

    after this the call was made a second time and returned

        "documentReady": true,
        "pageCount": 1,
        "documentMapAvailable": false,
        "bookmarkNodes": null

    and the report was rendered with the correct data.

    I also noticed that if I recycle the app pool, the report is rendered correctly, which points to something being cached in session. This is odd as the Web Api project has session state disabled.


    What do I need to do to get the report to be re rendered every time?




  2. Nasko
    Nasko avatar
    1071 posts

    Posted 22 Apr 2015 Link to this post

    Hello Colin,

    When the viewer is loaded in the web page it is registered as a new client of the service. Using the returned client ID it will request reports rendered in different formats. Until the last major release of Telerik Reporting the Reporting REST service cached the requested reports (uniquely identified by their report name and report parameter values) individually for each client until the cached report is deleted. The cached report will be also deleted when you hit the viewer's Refresh button.

    We received feedback that the caching mechanism would make much more sense if the cached reports are shared among all service clients. Thus, for the current major release (Q1 2015) we changed the caching mechanism, so that once a report is rendered, it is served to other client sessions as well for a set period of time.
    The purpose is to save resources and processing time for a report requested with the same parameter values.

    Calling the viewer's refreshReport method (use the method or the toolbar's refresh button), once the viewer is ready and loaded, or the underlying data is updated, will cause the report to be processed, rendered and cached again.

    A possible workaround is to have a DateTime report parameter passed to the report, containing the current date and time. Passing such parameter value will force the reporting engine to process the report anew.

    In addition we consider providing options for setting the expiration time of the cache in a future release of Telerik Reporting.


    See What's Next in App Development. Register for TelerikNEXT.

Back to Top