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

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

16 Answers 834 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ahmed
Top achievements
Rank 2
Ahmed asked on 23 Apr 2015, 01:10 AM

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>

16 Answers, 1 is accepted

Sort by
0
Ahmed
Top achievements
Rank 2
answered on 26 Apr 2015, 09:07 PM
any help with that please .... ?
0
Stef
Telerik team
answered on 27 Apr 2015, 07:20 AM
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.

 
0
Ahmed
Top achievements
Rank 2
answered on 28 Apr 2015, 12:06 PM

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 ?

0
Ahmed
Top achievements
Rank 2
answered on 28 Apr 2015, 12:15 PM

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 ...

0
Stef
Telerik team
answered on 28 Apr 2015, 01:26 PM
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.

 
0
Ahmed
Top achievements
Rank 2
answered on 28 Apr 2015, 03:59 PM

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 ?

 

0
Ahmed
Top achievements
Rank 2
answered on 28 Apr 2015, 04:01 PM

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>
}

0
Stef
Telerik team
answered on 30 Apr 2015, 11:16 AM
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.

 
0
Ahmed
Top achievements
Rank 2
answered on 30 Apr 2015, 12:30 PM
Thanks a lot ....
0
Ahmed
Top achievements
Rank 2
answered on 30 Apr 2015, 11:57 PM

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?

0
Stef
Telerik team
answered on 04 May 2015, 03:23 PM
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.

 
0
Ahmed
Top achievements
Rank 2
answered on 04 May 2015, 11:04 PM

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 ?

0
Stef
Telerik team
answered on 13 May 2015, 02:57 PM
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
0
Samer
Top achievements
Rank 1
answered on 28 Jul 2015, 04:09 PM

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

 

0
Kyle
Top achievements
Rank 1
answered on 03 Aug 2016, 04:21 PM
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.
0
Katia
Telerik team
answered on 05 Aug 2016, 12:55 PM
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
Tags
General Discussions
Asked by
Ahmed
Top achievements
Rank 2
Answers by
Ahmed
Top achievements
Rank 2
Stef
Telerik team
Samer
Top achievements
Rank 1
Kyle
Top achievements
Rank 1
Katia
Telerik team
Share this question
or