Telerik Forums
Reporting Forum
0 answers
39 views

Hi All,

I want to pass few additional parameters from the report designer to the report service each and every request.

Following is my current code.

<script type="text/javascript">
        $(document).ready(function () {

            // For a complete overview over all the options used to initialize Web Report Designer, check:
            // https://docs.telerik.com/reporting/designing-reports/report-designer-tools/web-report-designer/web-report-designer-initialization
        $("#webReportDesigner").telerik_WebReportDesigner({
                toolboxArea: {
                    layout: "list" //Change to "grid" to display the contents of the Components area in a flow grid layout.
            },

            blpermision: {
                isJson: 'Nom'
            },

                serviceUrl: "@(basePath)reportdesigner/",
                report: "",
                skipOnboarding: true,

                // Example of passing parameters to the embedded Report Viewer used when previewing documents.
                // The example below demonstrates the currently available options.
                // reportViewerOptions: {
                //    scaleMode: telerikReportViewer.ScaleModes.SPECIFIC,
                //    scale: 1.0,
                //    templateUrl: "https://bluelotus360.co/ReportsAPI/api/reportdesginer/resources/templates/telerikReportViewerTemplate.html/",
                //    viewMode: telerikReportViewer.ViewModes.INTERACTIVE,
                //    pageMode: telerikReportViewer.PageModes.CONTINUOUS_SCROLL
                //    // Further explanation about how these options effect the Report Viewer can be found at:
                //    // https://docs.telerik.com/reporting/embedding-reports/display-reports-in-applications/web-application/html5-report-viewer/api-reference/report-viewer-initialization
                // }
        }).data("telerik_WebDesigner");
        
        });
</script>

Is there a way to tap each and every request to designer services .

 

Additionally i cannot over ride certain actions in report designer services. cannot override  SaveResource endpoint. any idea ?

 


  [Route("api/reportdesigner")]
  public class ReportDesignerController : ReportDesignerControllerBase
  {
      public ReportDesignerController(IReportDesignerServiceConfiguration reportDesignerServiceConfiguration, IReportServiceConfiguration reportServiceConfiguration)
          : base(reportDesignerServiceConfiguration, reportServiceConfiguration)
      {
          var m = reportDesignerServiceConfiguration;
       //  m.DefinitionStorage = new FileDefinitionStorage("~/CSR/");


      }


      public override IActionResult CreateDocument(string clientID, string instanceID, [FromBody] CreateDocumentArgs args)
      {
          return base.CreateDocument(clientID, instanceID, args);
      }

      [HttpPost("definitionresources/save")]
  
      public override Task<IActionResult> SaveResource([FromQuery] SaveResourceModel model)
      {
          return base.SaveResource(model);
      }


  }

BL360
Top achievements
Rank 1
 asked on 07 Dec 2023
0 answers
192 views

I would like to populate and disable the From input from the client. I am running into a few issues:

 

1. It appears the viewer page is blocking the bundled javascript include. As a work around I am including the script file in the header which works fine and acceptable for me.

    <script src="@Url.Content("~/scripts/reportsportal.js")"></script>

2. It appears that something is blocking the ability to bind to the event SEND_EMAIL_BEGIN

ex in my script file reportsportal.js I am attempting to bind to the SEND_EMAIL_BEGIN so that I can populate and disable the FROM input using jquery

 

However it appears that my script file is getting blocked and the following message is displayed in the browser console:

Autofocus processing was blocked because a document already has a focused element. 

 

I don't think the script runs at all.

 

$(document).ready(function () {
    if (reportViewer) {

        reportViewer.bind(telerikReportViewer.Events.SEND_EMAIL_BEGIN, function (e) {
            debugger
            console.log(this.id);
        });
    }


});

 

 

 

 

3. As a work around to not being able to bind to SEND_EMAIL_BEGIN , I wired one of the declarative events on the viewer widget:

        .ClientEvents(ev=>ev.PageReady("printPageReady"))

 

In printPageReady I was able to capture the From field with a selector

function printPageReady() {
    var t = $('input[name="from"]')
    t.val('test@yahoo.com')
}

Setting val on input[name="from"] DOES NOT generate any exceptions and checking the variable t in the console shows that a value has been assigned however when the Send Email dialog pops up the From input is still empty.

 

 

Is there another approach that I can use to access, disable and populate the From input from the client.

 

 

Sean
Top achievements
Rank 1
Iron
Iron
 asked on 06 Nov 2023
0 answers
79 views

Hello,

I am getting the following error when trying to print a report from my website:

But when in my local machine, it displays correctly. The database is the same, no changes between then.

Regards,

Alexandre

Alexandre
Top achievements
Rank 2
Iron
Iron
Iron
 asked on 04 Jul 2023
0 answers
70 views

My report viewer was working without issue for some time until caching with DistributedSqlServerCache was implemented. It is configured as follows.

services.TryAddSingleton<IReportServiceConfiguration>(configuration =>
    new ReportServiceConfiguration {
        HostAppId = "Reports",
        ReportingEngineConfiguration = new ConfigurationBuilder().AddJsonFile(Path.Combine(configuration.GetService<IWebHostEnvironment>().ContentRootPath, "appsettings.json"), true).Build(),
        ReportSourceResolver = new UriReportSourceResolver(Path.Combine(configuration.GetService<IWebHostEnvironment>().ContentRootPath, "App_Data")).AddFallbackResolver(new TypeReportSourceResolver()),
        Storage = new MsSqlServerStorage("connection-string")
    }
);
public class ReportsController : ReportsControllerBase {
    public ReportsController(IReportServiceConfiguration reportServiceConfiguration) : base(reportServiceConfiguration) {
        reportServiceConfiguration.Storage.AcquireLock(string.Format("Lock-{0}", new Random().Next()));
    }
}

Note that the AcquireLock() method mentioned above was added in response to this comment from Telerik:

The interface also exposes a method called AcquireLock which is used from the service to enforce serialized access to all stored resources from each thread of the application and between the instances of the application in case of multi-instance environment (i.e., Web Farm)

Which I suspect may apply here, but unfortunately I can only hazard guess in light of its appalling lack of documentation.

A typical error message reported by the viewer is:

Error creating report document (Report = 'XXXXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'; Format = 'HTML5'). An error has occurred. Object reference not set to an instance of an object.

As a workaround, I have resorted to manually configuring the report viewer, then editing a method in the javascript file, from this:
function registerDocumentAsync(format, deviceInfo, useCache, baseDocumentId, actionId) {
    throwIfNotInitialized();
    throwIfNoReportInstance();

    return client.createReportDocument(clientId, reportInstanceId, format, deviceInfo, useCache, baseDocumentId, actionId).catch(function(xhrErrorData) {
        handleRequestError(xhrErrorData, utils.stringFormat(sr.errorCreatingReportDocument, [ utils.escapeHtml(report), utils.escapeHtml(format) ]));
    });
}

to this:

function registerDocumentAsync(format, deviceInfo, useCache, baseDocumentId, actionId) {
    throwIfNotInitialized();
    throwIfNoReportInstance();

    return client.createReportDocument(clientId, reportInstanceId, format, deviceInfo, useCache, baseDocumentId, actionId).catch(function () {
        console.log("Failed to create report document. A retry has been attempted.");

        return client.createReportDocument(clientId, reportInstanceId, format, deviceInfo, useCache, baseDocumentId, actionId).catch(function (xhrErrorData) {
            handleRequestError(xhrErrorData, utils.stringFormat(sr.errorCreatingReportDocument, [utils.escapeHtml(report), utils.escapeHtml(format)]));
        });
    });
}
Up until now, the second attempt has worked every time. The odd thing is, after the workaround is applied it can continue to work for some time without failing again, even after loading a different page. Given that I cannot reproduce this issue locally, I suspect there may be a race condition happening.
Steve
Top achievements
Rank 1
 updated question on 03 Jul 2023
0 answers
67 views
i can get the document map on my local machine but when deployed on the server it is not applied please help me to resolve it thanks
0 answers
291 views

Hello EveryBody,

I have an mvc aplication in .netcore6 where i´m implementing a telerik reporting 2022 reportviewer´s, but when testing it on a linux machine the report generates this error:

 {"message":"An error has occurred.","exceptionMessage":"Type: Telerik.Reporting.ReportSerialization.V4_0.ReportSerializable`1[Telerik.Reporting.Report]","exceptionType":null,"stackTrace":null}

It is the response when the reportviewer consult the parameters of the report.

this error does not occur in windows machine

 

This error occurs when add several mvc controllers to my project,

 

Help me!

Mauricio Noguera
Top achievements
Rank 2
 asked on 23 Sep 2022
0 answers
416 views

 am trying to upgrade an ASP.Net MVC (.net framework 4.6.1) application from Telerik Reporting R1 2018 to R2 2022 and can't even get the viewer to display.  The error on screen says

Cannot access the Reporting REST service. (serviceUrl = '/api/reportsapi/'). Make sure the service address is correct and enable CORS if needed. (https://enable-cors.org)

When I open the browser developer tools I see the error has occurred on the call to api/reportsapi/version and the exception message is:

Multiple actions were found that match the request: System.Net.Http.HttpResponseMessage GetDocumentFormats() no tipo Telerik.Reporting.Services.WebApi.ReportsControllerBase System.Net.Http.HttpResponseMessage GetClientsSessionTimeoutSeconds() no tipo Telerik.Reporting.Services.WebApi.ReportsControllerBase System.Net.Http.HttpResponseMessage GetVersion() no tipo Telerik.Reporting.Services.WebApi.ReportsControllerBase</ExceptionMessage>

Any idea where to even begin looking?  The prior version worked flawlessly.  We do have a custom report resolver because we change the connection string based on the tenant ID of the logged in user, but I have upgraded that.

Clovis
Top achievements
Rank 1
 asked on 22 Jul 2022
0 answers
37 views

Hi all,

Some times we are getting above attached errors when generating reports. after pressing refresh button the report will load correctly. we are using .net 6 app to show the report viewer.

 

Are there any solutions to fix my issue. If any one want more information please comment below..
Thank you

 

Mail
Top achievements
Rank 1
 updated question on 21 Jul 2022
0 answers
95 views

Hi,

 

I am using the HTML5 viewer under .Net 6. I have 2 parameters CICAreaFilter and SubReportVisible.

I am using this Javascript to pass values to these parameters:

        $(document).ready(function () {

            $("#reportViewer1")
                .telerik_ReportViewer({
                    serviceUrl: "api/reports",
                    reportSource: { report: "First Attempt.trdp" },
                    parameters: [ { CICAreaFilter: 'GEN' }, { SubReportVisible: true }],
                    scaleMode: telerikReportViewer.ScaleModes.SPECIFIC,
                    scale: 1.0
                });
        });

The parameters are not being set in the report. What do I need to change to get these parameters to work? I have tried 1 parameter and it also does not work.

 

Thanks.

 

Lloyd.

Lloyd
Top achievements
Rank 1
 asked on 22 Jun 2022
Top users last month
Patrick
Top achievements
Rank 1
Iron
Iron
Iron
MIS
Top achievements
Rank 1
Ross
Top achievements
Rank 1
Marcin
Top achievements
Rank 1
Iron
Iron
Sean
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?