Unable to get report parameters

9 posts, 0 answers
  1. Andrew
    Andrew avatar
    6 posts
    Member since:
    Feb 2016

    Posted 08 May 2017 Link to this post

    Hi,

    I have a created a .NET Core application and I have added the Telerik reporting controller as detailed in: http://www.telerik.com/blogs/telerik-reporting-and-aspnet-core

    It runs fine when I am using external tdrp reports. 

    However I am keen to create a report library and use CLR type names.

    Unfortunately I am getting the follow error when trying to view the report:

    "Unable to get report parameters.
    undefinedReport 'Aliaxis.ReportLibrary.Report1%2C%20Aliaxis.ReportLibrary' cannot be resolved."

     

    My viewer report source is set as below :-

                        //ReportSource - report description
                        reportSource: { 
                            // The report can be set to a report file name
                            // or CLR type name (report class definition).
                            //report: "test.trdp",
                            report: "Aliaxis.ReportLibrary.Report1, Aliaxis.ReportLibrary",
     
                            // Parameters name value dictionary
                            parameters: {}
                        }

     

    Report 1 is a blank report with a textbox in the center. Its namespace/class name is :-

     

    namespace Aliaxis.ReportLibrary
    {
        partial class Report1

     

    Any advice on why I can't get the report to display and am getting this error?

    Kind Regards,

    Tom

     

  2. Andrew
    Andrew avatar
    6 posts
    Member since:
    Feb 2016

    Posted 08 May 2017 Link to this post

    I ran fiddler and this is the response I received if it helps:

     

    400
    {"Message":"","ExceptionMessage":"Report 'Aliaxis.ReportLibrary.Report1%2C%20Aliaxis.ReportLibrary' cannot be resolved.","ExceptionType":"Telerik.Reporting.Services.Engine.InvalidReportException","StackTrace":"   at Telerik.Reporting.Services.Engine.ReportEngine.ResolveReportSource(String report)\r\n   at Telerik.Reporting.Services.Engine.ReportEngine.GetParameters(String clientID, String report, Dictionary`2 parameterValues)\r\n   at Telerik.Reporting.Services.AspNetCore.ReportsControllerBase.GetParameters(String clientID, ClientReportSource reportSource)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__27.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.AspNetCore.Mv
    208
    c.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__25.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)\r\n   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextExceptionFilterAsync>d__24.MoveNext()"}
    0

  3. Andrew
    Andrew avatar
    6 posts
    Member since:
    Feb 2016

    Posted 08 May 2017 Link to this post

    Apologies, you can ignore this question. I've added .AddFallbackResolver(new ReportTypeResolver()) to my rest api  controller and all seems to be working.
  4. Ricardo
    Ricardo avatar
    1 posts
    Member since:
    Jul 2017

    Posted 29 Sep 2017 Link to this post

    Hi, I have te same problem, but i´m unable to get the report from the api
  5. Katia
    Admin
    Katia avatar
    693 posts

    Posted 04 Oct 2017 Link to this post

    Hi Ricardo,

    What is the error message you receive in the viewer? We would need to check the settings of the viewer and implementation of the REST service (ReportsController) in order to provide you further suggestions.

    Most common issues with HTML5 Viewer and the troubleshooting approaches are provided in HTML5 Viewer Troubleshooting help article.


    Regards,
    Katia
    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
  6. UnstablePixel
    UnstablePixel avatar
    4 posts
    Member since:
    Mar 2019

    Posted 09 May in reply to Andrew Link to this post

    Andrew said:Apologies, you can ignore this question. I've added .AddFallbackResolver(new ReportTypeResolver()) to my rest api  controller and all seems to be working.

    where is the REST api controller?

  7. Todor
    Admin
    Todor avatar
    289 posts

    Posted 10 May Link to this post

    Hello UnstablePixel,

    The Web API Controller is configured by default in the ReportsController class. For details you may check How To: Add Telerik Reporting REST Web API to Web Application and How To: Implement the ReportsController in an application articles.
    The communication between the viewer and the REST Service is explained in HTML5 Report Viewer and Reporting REST services article.

    Regards,
    Todor
    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
  8. Nick
    Nick avatar
    1 posts
    Member since:
    Oct 2015

    Posted 13 May Link to this post

    I am getting the exact same error in my HTML 5 viewer, what is the reason for this? seems to happen in many projects when using the latest dll. Code and error below

     

    Viewer Error

    Unable to get report parameters.
    Report 'ReportLibrary.AccountsReport%2C%20ReportLibrary' cannot be resolved.

    Browser Console error
    Failed to load resource: the server responded with a status of 404 ()
    AccountsReport.html:1 Uncaught (in promise) Error shown. Throwing promises chain stop error.

    Report API Code

     public class ReportsController : ReportsControllerBase
        {
            static ReportServiceConfiguration configurationInstance;

            static ReportsController()
            {
                //This is the folder that contains the XML (trdx) report definitions
                //In this case this is the app folder
                var reportsPath = HttpContext.Current.Server.MapPath("~/");

                //Add resolver for trdx report definitions,
                //then add resolver for class report definitions as fallback resolver;
                //finally create the resolver and use it in the ReportServiceConfiguration instance.
                var resolver = new ReportFileResolver(reportsPath)
                    .AddFallbackResolver(new ReportTypeResolver());

                //Setup the ReportServiceConfiguration
                configurationInstance = new ReportServiceConfiguration
                {
                    HostAppId = "MvcApp",
                    Storage = new FileStorage(),
                    ReportResolver = resolver,
                    // ReportSharingTimeout = 0,
                    // ClientSessionTimeout = 15,
                };
            }

            public ReportsController()
            {
                //Initialize the service configuration
                this.ReportServiceConfiguration = configurationInstance;
            }
        }
    Viewer Code
     $(document).ready(function () {
                $("#reportViewer1")
                    .telerik_ReportViewer({

                        // The URL of the service which will serve reports.
                        // The URL corresponds to the name of the controller class (ReportsController).
                        // For more information on how to configure the service please check http://www.telerik.com/help/reporting/telerik-reporting-rest-conception.html.
                        serviceUrl: "/api/reports",

                        // The URL for custom report viewer template. The template can be edited -
                        // new functionalities can be added and unneeded ones can be removed.
                        // For more information please check http://www.telerik.com/help/reporting/html5-report-viewer-templates.html.
                        //

                        //ReportSource - report description
                        reportSource: {
                            // The report can be set to a report file name (trdx report definition)
                            // or CLR type name (report class definition).
                            report: "ReportLibrary.AccountsReport, ReportLibrary"
                        },

                        // Specifies whether the viewer is in interactive or print preview mode.
                        // PRINT_PREVIEW - Displays the paginated report as if it is printed on paper. Interactivity is not enabled.
                        // INTERACTIVE - Displays the report in its original width and height without paging. Additionally interactivity is enabled.
                        viewMode: telerikReportViewer.ViewModes.PRINT_PREVIEW,

                        // Sets the scale mode of the viewer.
                        // Three modes exist currently:
                        // FIT_PAGE - The whole report will fit on the page (will zoom in or out), regardless of its width and height.
                        // FIT_PAGE_WIDTH - The report will be zoomed in or out so that the width of the screen and the width of the report match.
                        // SPECIFIC - Uses the scale to zoom in and out the report.
                        scaleMode: telerikReportViewer.ScaleModes.SPECIFIC,

                        // Zoom in and out the report using the scale
                        // 1.0 is equal to 100%, i.e. the original size of the report
                        scale: 1.0,

                        ready: function () {
                            //this.refreshReport();
                        },
                        parameterEditors: [
                       {
                           match: function (parameter) {
                               return parameter.type === "System.DateTime";
                           },
     
                           createEditor: function (placeholder, options) {
                               $(placeholder).html('<input type="datetime"/>');
                               var dateTimePicker = $(placeholder),
                                                    parameter,
                                                    valueChangedCallback = options.parameterChanged,
                                                    dropDownList;
     
     
                               function onChange() {
                                   var dtv = this.value();
                                   if (null !== dtv) {
                                       dtv = myadjustTimezone(dtv);
                                   }
                                   valueChangedCallback(parameter, dtv);
                               }
     
                               return {
                                   beginEdit: function (param) {
                                       parameter = param;
     
                                       var dt = null;
                                       try {
                                           if (param.value) {
                                               dt = myunadjustTimezone(param.value);
                                           }
                                       } catch (e) {
                                           dt = null;
                                       }
     
                                       $(dateTimePicker).find("input").kendoDateTimePicker({
                                           format: "dd/MM/yyyy",
                                           parseFormats: ["MM/dd/yyyy"],
                                           min: new Date(2010, 0, 1, 1, 0, 0),
                                           max: new Date(2100, 0, 1, 1, 0, 0),
                                           change: onChange,
                                           value: dt
                                       });
     
     
     
                                       dropDownList = $(dateTimePicker).find("input").data("kendoDateTimePicker");
     
                                   }
     
                               }
                           }
                       }]
                    });
            });

     

  9. Todor
    Admin
    Todor avatar
    289 posts

    Posted 16 May Link to this post

    Hi Nick,

    I noticed that you are already discussing the issue in the Support ticket you opened on the same topic. Let's continue resolving the problem there.

    Regards,
    Todor
    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