HTML5 Report Viewer - Report not refreshed if i change values in DB ?

17 posts, 0 answers
  1. Ahmed Amin
    Ahmed Amin avatar
    34 posts
    Member since:
    Apr 2015

    Posted 22 Apr 2015 Link to this post

    Hi

    i have create HTML5 report and it works with parameter but it's don't refresh (get new data from DB) as example:

    1. items qty in db was 5 for order is no 1

    2. i type in parameter section 1 and get qty 5 in my report >> that is OK

    3. now i edit qty in my db and set it to be 3

    4. i type in parameter section 2 and get qty of orderid 2

    5. now i type 1 again in parameter section and get qty 5 >> that is wrong qty now in db is 3 ??!!

     so how can i let report refreshed as it should be (check data each time i type value in parameter section)

    Note: when i click refresh icon in report viewer i get report with new data - but i don't need client to click this button each time i just need report data refreshed each time i type an value or each time report is created 

    Code:

    @* Order Report *@
    <div id="reportViewer2" style="height:1241px;">
        loading...
    </div>
     
        @* Order Report *@
        <script>
            $(document).ready(function () {
                $("#reportViewer2")
                    .telerik_ReportViewer({
                        serviceUrl: "/api/reports",
                        templateUrl: '/ReportViewer/templates/telerikReportViewerTemplate-9.0.15.225.html',
                        reportSource: {
                            report: "Hemdan.Views.kinds.Select_Order_BarCode, Hemdan",
                        },
                        viewMode: telerikReportViewer.ViewModes.INTERACTIVE,
                        scaleMode: telerikReportViewer.ScaleModes.SPECIFIC,
                        scale: 1.0,
                    });
            });
        </script>

  2. Ahmed Amin
    Ahmed Amin avatar
    34 posts
    Member since:
    Apr 2015

    Posted 26 Apr 2015 in reply to Ahmed Amin Link to this post

    any help with that please .... ?
  3. DevCraft banner
  4. Stef
    Admin
    Stef avatar
    3053 posts

    Posted 27 Apr 2015 Link to this post

    Hello Ahmed,

    This is an optimization in the reports caching which allows you to render a specififc report for a given set of parameters and save time from processing the same report with the same set of parameters on consecutive calls.

    Please check the following forum thread and test upgrading your project to the mentioned internal build 9.0.15.422 and/or adding a DateTime parameter, which value is always updated from the client ( a new Date() is submitted on each request for report) -  Web Api Caching and resolving issues.


    I hope the provided information is helpful.

    Regards,
    Stef
    Telerik
     

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

     
  5. Ahmed Amin
    Ahmed Amin avatar
    34 posts
    Member since:
    Apr 2015

    Posted 28 Apr 2015 in reply to Stef Link to this post

    Thanks for Replying

    I can't download ver 9.0.15.422 - i try click the link on the post but can't download it - and i download trial again but got ver 9.0.15.324 - are it's not available for download yet ?

    Not: i try code in the same post but i get err in 2 lines

    static ReportServiceConfiguration preservedConfiguration;
     
    static IReportServiceConfiguration PreservedConfiguration
     i got:

    Error   2   The type or namespace name 'ReportServiceConfiguration' could not be found (are you missing a using directive or an assembly reference?)
     
     
    Error   3   The type or namespace name 'IReportServiceConfiguration' could not be found (are you missing a using directive or an assembly reference?)
     

    and try to add date time param but report still not refreshed as it should be ??!!

    so please how can i resolve that ?

  6. Ahmed Amin
    Ahmed Amin avatar
    34 posts
    Member since:
    Apr 2015

    Posted 28 Apr 2015 Link to this post

    please if you can give me an example for report works with 2 params 

    1. is orderid or any thing else

    2. datetime params >> that make report refreshed each time 

    or fix above err in my previews reply ...

  7. Stef
    Admin
    Stef avatar
    3053 posts

    Posted 28 Apr 2015 Link to this post

    Hi Ahmed,

    You can download the latest available internal build after logging into your Telerik account and navigating to Products & Subscriptions - Latest internal Builds. Then in the drop-down select Reporting and there will be displayed a download link for the internal build, including release notes link.

    Please give a try of the internal build and let us know if you still need a workaround.

    Regards,
    Stef
    Telerik
     

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

     
  8. Ahmed Amin
    Ahmed Amin avatar
    34 posts
    Member since:
    Apr 2015

    Posted 28 Apr 2015 in reply to Stef Link to this post

    Hi Stef

    i download it and use code as:

     

    using System.Web;
    using Telerik.Reporting.Cache.Interfaces;
    using Telerik.Reporting.Services.Engine;
    using Telerik.Reporting.Services.WebApi;
    using System.Linq;
    using Telerik.Reporting.Services;
    using Telerik.Reporting.Cache.File;
    using System.IO;
     
    namespace WebApplication1.Controllers
    {
        public class ReportsController : ReportsControllerBase
        {
     
            static ReportServiceConfiguration preservedConfiguration;
     
            static IReportServiceConfiguration PreservedConfiguration
            {
                get
                {
                    if (null == preservedConfiguration)
                    {
                        preservedConfiguration = new ReportServiceConfiguration
                        {
                            HostAppId = "WebApplication1",
                            Storage = new FileStorage(),
                            ReportResolver = CreateResolver(),
                            CachedReportTimeout = 0,
                            ClientSessionTimeout = 0,
                        };
                    }
                    return preservedConfiguration;
                }
            }
     
            public ReportsController()
            {
                this.ReportServiceConfiguration = PreservedConfiguration;
            }
     
            static IReportResolver CreateResolver()
            {
                var reportsPath = HttpContext.Current.Server.MapPath("~/Reports");
     
                return new ReportFileResolver(reportsPath)
                    .AddFallbackResolver(new ReportTypeResolver());
            }
     
            //protected override ICache CreateCache()
            //{
            //    return Telerik.Reporting.Services.Engine.CacheFactory.CreateFileCache();
            //}
        }
    }

    but report still not refreshed as i need, so please did i set  CachedReportTimeout  into right format or what is the problem ?

     

  9. Ahmed Amin
    Ahmed Amin avatar
    34 posts
    Member since:
    Apr 2015

    Posted 28 Apr 2015 Link to this post

    my report code is:

     

    @* Order Report *@
    <div id="reportViewer2" style="height:1241px;">
        loading...
    </div>
     
    @section scripts
    {
     
        @* Order Report *@
        <script>
            $(document).ready(function () {
                $("#reportViewer2")
                    .telerik_ReportViewer({
                        serviceUrl: "/api/reports",
                        templateUrl: '/ReportViewer/templates/telerikReportViewerTemplate-9.0.15.422.html',
                        reportSource: {
                            report: "WebApplication1.Report1, WebApplication1",
                        },
                        viewMode: telerikReportViewer.ViewModes.INTERACTIVE,
                        scaleMode: telerikReportViewer.ScaleModes.SPECIFIC,
                        scale: 1.0,
                    });
            });
        </script>
    }

  10. Stef
    Admin
    Stef avatar
    3053 posts

    Posted 30 Apr 2015 Link to this post

    Hi Ahmed,

    In your last post in HTML5 Report Viewer - Report don't get value from drpdownlist and not refreshed ? you state that the issue with refreshing reports is resolved.

    If I questions are not related and the problem still occurs, please open a support ticket and send us the following details:
    1. A video illustrating the problem on your machine;
    2. Log file created by Fiddler. For the purpose download and install Fiddler and run it in parallel to the application in browser - Create a Session Archive Zip (SAZ) Traffic archive.


    Regards,
    Stef
    Telerik
     

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

     
  11. Ahmed Amin
    Ahmed Amin avatar
    34 posts
    Member since:
    Apr 2015

    Posted 30 Apr 2015 Link to this post

    Thanks a lot ....
  12. Ahmed Amin
    Ahmed Amin avatar
    34 posts
    Member since:
    Apr 2015

    Posted 30 Apr 2015 Link to this post

    Note: the problem is resolved when try to pass param value from external input not (Parameter Area) like textbox or dropdownlist ...... 

    i try it again and the problem is still (ver 9.0.15.324) - i just need any way that i can refresh report each time i change values like this :

    $('#ProductID').change(function () {
        var viewer = $("#reportViewer1").data("telerik_ReportViewer");
        viewer.reportSource({
            report: viewer.reportSource().report,
            parameters: { Orderid: $(this).val() }
        });
        viewer.refreshReport();
    });

    this is working very good if i have an external dropdownlist and each time i select new value or change values in db and then select item again from drp i got report with new data each time

    i need to do this way with working with parameter area i set params to auto refresh but still don't get data with last update i must click on refresh button in the report viewer and when i do that i got report with correct data ?

    so how can i do refresh here as i do with above code ?

    $(document).ready(function () {
        $("#reportViewer2")
            .telerik_ReportViewer({
                serviceUrl: "/api/reports",
                templateUrl: '/ReportViewer/templates/telerikReportViewerTemplate-9.0.15.324.html',
                reportSource: {
                    report: "WebApplication1.Reports.Report2, WebApplication1",
                },
                viewMode: telerikReportViewer.ViewModes.INTERACTIVE,
                scaleMode: telerikReportViewer.ScaleModes.SPECIFIC,
                scale: 1.0,
            });
    });

    i think there is must be way to do that - hope to give me full steps?

  13. Stef
    Admin
    Stef avatar
    3053 posts

    Posted 04 May 2015 Link to this post

    Hello Ahmed,

    the options are:
    1. Use the current version and add a Datetime parameter in the report, where parameters values are updated via external custom UI;
    2. Upgrade to 9.0.15.422 and use the new cache settings for the Reporting REST service - Web Api Caching and resolving issues (my last post). The internal build can be downloaded after logging into your Telerik account and navigating to Products & Subscriptions - Latest internal builds - select Reporting in the drop-down.
      With these update you will not need to call the viewer's refreshReport method.


    Regards,
    Stef
    Telerik
     

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

     
  14. Ahmed Amin
    Ahmed Amin avatar
    34 posts
    Member since:
    Apr 2015

    Posted 04 May 2015 in reply to Stef Link to this post

    Thanks, can you please give me sample project that working with DateTime Param to let me know how to do it ?

    please when will ver 9.0.15.422 will be out ?

  15. Stef
    Admin
    Stef avatar
    3053 posts

    Posted 13 May 2015 Link to this post

    Hi Ahmed,

    Telerik Reporting v9.0.15.422 is available for download as of April 22, 2015. It can be downloaded from your Telerik account - Products & Subscriptions - Latest internal builds - Reporting.

    The other approach requires:
    1. A DateTime report parameter in the report - How to: Add Report Parameters.
    2. Update the value of the DateTime parameter on updating the viewer's reportSource as follows:
      $('#ProductID').change(function () {
          var viewer = $("#reportViewer1").data("telerik_ReportViewer");
          viewer.reportSource({
              report: viewer.reportSource().report,
              parameters: {
                      Orderid: $(this).val(),
                      TheDatetimeParameter: new Date() }
          });
          viewer.refreshReport();
      });


    Regards,
    Stef
    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
  16. Samer
    Samer avatar
    1 posts
    Member since:
    Dec 2014

    Posted 28 Jul 2015 in reply to Ahmed Amin Link to this post

    hi Ahmad 

    i stared work telerik reporting with MVC  

    can you help me by provide me sample work i need to desing report by "telerik stand alone designer"

    and add it to MVC project and can send data to report in controller ??

    best regards 

    Samer Al-Dwaik

     

  17. Kyle
    Kyle avatar
    15 posts
    Member since:
    Mar 2016

    Posted 03 Aug Link to this post

    I'm having the same problem till (Q1 2016). But with only one of our reports. Even if we pass the date time parameter it still goes to the cache (db log shows sp never executed). When we call the sp directly with the same parameters we see data, but for the report it keeps using a cached report that had no data. Even calling refreshReport() does not fix the issue — it still goes to the cache.
  18. Katia
    Admin
    Katia avatar
    309 posts

    Posted 05 Aug Link to this post

    Hello Kyle,

    Set the ReportSharingTimeout Property in the ReportsController file to 0 to prevent the cached report from being reused. Also, set the PersistSession option of the viewer to False.

    In case the issue persists, please attach a runnable demo project reproducing this behavior in a support ticket so we can test it locally and provide you further suggestions.


    Regards,
    Katia
    Telerik by Progress
    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
DevCraft banner