Telerik Forums
Reporting Forum
1 answer
392 views

Here is my problem.  Our shop has three environments that the development team must work with, development, testing and production.  I have successfully been able to change the DataSource (WebServiceDataSource) of the master report by changing the ServiceUrl.  For subreports I have been able to change the ReportSource based on the environment but I have not been able to locate a way to change the DataSource.  Does anyone have an idea how this is done? 

Here is the code I have right now:

public class TexasProtaxCustomReportResolver : Telerik.Reporting.Services.Engine.IReportResolver
    {
        private readonly string _path;
        private readonly string _apiUrl;
 
        public TexasProtaxCustomReportResolver(string path, string apiUrl)
        {
            _path = path;
            _apiUrl = apiUrl;
        }
 
        public Telerik.Reporting.ReportSource Resolve(string reportName)
        {
            var reportPacker = new ReportPackager();
 
            string reportPath = Path.Combine(_path, reportName);
            using (var sourceStream = System.IO.File.OpenRead( reportPath))
            {
                var report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream);
                SetReportSource((ReportItemBase)report);
 
                var irs = new InstanceReportSource
                {
                    ReportDocument = report
                };
 
                return irs;
            }
 
        }
 
       private void SetReportSource(ReportItemBase reportItemBase)
        {
            if (reportItemBase.Items.Count < 1)
                return;
 
            if (reportItemBase is Telerik.Reporting.Report)
            {
                var report = (Telerik.Reporting.Report)reportItemBase;
 
                var webServiceDataSource = (WebServiceDataSource)report.DataSource;
                string url = webServiceDataSource.ServiceUrl;
                url = url.ToLower().Replace("localhost:5001", _apiUrl);
                webServiceDataSource.ServiceUrl = url;
            }
 
            foreach (var item in reportItemBase.Items)
            {
                // recursively set the reportsource
                SetReportSource(item);
 
                if (item is SubReport subReport)
                {
                    // Save Parameters
                    var clonable = subReport.ReportSource.Parameters as ICloneable;
                    var parameters = (ParameterCollection)clonable.Clone();
 
                    string fileName = Path.GetFileName(subReport.ReportSource.ToString());
                    var uriReportSource = new UriReportSource
                    {
                        Uri = Path.Combine(_path, fileName)
                    };
                    uriReportSource.Parameters.AddRange(parameters);
 
                    subReport.ReportSource = uriReportSource;
 
                    continue;
                }
            }
        }
 
    }
Carlos
Top achievements
Rank 1
 answered on 19 Feb 2020
2 answers
871 views

Ticket :1453373

Report shows all records in Visual Studio when I Preview it in the preview page but when running the winform application from the IDE (and as a stand alone app) the viewer stops when record count ~> 220 records showing the above error. When I capture the error event and display said error in a messagebox the first page is displayed. On it I can see that pages are calculated (as my first page displays page 1 of 75) so I can conclude that the records are definitely getting retrieved, just not displayed. I say that the record count is ~> 220 because when I narrow the parameters to display < 220 records the report is generated fine: adding 10 more records to the report causes the error.
As I said, the report previews perfectly.

I call the report using

Dim TR As MaserNET.ReportViewerForm1 = New MaserNET.ReportViewerForm1
TR.ReportName = "Maserrep.DDRegister, Maserrep, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null"
TR.ShowDialog()

 

and the viewer shows the report using

 

Dim typeReportSource = New Telerik.Reporting.TypeReportSource()
Dim connectionStringHandler = New ReportConnectionStringManager(GlobalConnection.ConnectionString)
typeReportSource.TypeName = ReportName
Dim reportSource = connectionStringHandler.UpdateReportSource(typeReportSource) Me.ReportViewer1.ReportSource = reportSource Me.ReportViewer1.RefreshReport()

What am I missing????

Katia
Telerik team
 answered on 19 Feb 2020
2 answers
336 views
I'm experiencing an issue when a page references both Kendo UI and Telerik Reporting HTML5 libraries. If on a page I need to call kendo UI grid control I get an error message: 

TypeError: n._pageableQueryOptions is not a function
    at HTMLSelectElement.pageSize (kendo.all.min.js:28)
    at HTMLSelectElement.<anonymous> (jquery.min.js?v=FgpCb_KJQlLNfOu91ta32o_NMZxltwRo8QtmkMRdAu8:2)
    at Function.each (jquery.min.js?v=FgpCb_KJQlLNfOu91ta32o_NMZxltwRo8QtmkMRdAu8:2)
    at E.fn.init.each (jquery.min.js?v=FgpCb_KJQlLNfOu91ta32o_NMZxltwRo8QtmkMRdAu8:2)
    at E.fn.init.val (jquery.min.js?v=FgpCb_KJQlLNfOu91ta32o_NMZxltwRo8QtmkMRdAu8:2)
    at new init (kendo.all.min.js:40)
    at init._pageable (kendo.all.min.js:60)
    at new init (kendo.all.min.js:57)
    at HTMLDivElement.<anonymous> (kendo.all.min.js:26)
    at Function.each (jquery.min.js?v=FgpCb_KJQlLNfOu91ta32o_NMZxltwRo8QtmkMRdAu8:2)





It looks like there is a conflict between the libraries.This is how page looks like:
<!DOCTYPE html>
<html>
<head>
    <title>Report Viewer Demo</title>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />

    <link rel="stylesheet" href="/lib/telerik.kendo-ui/css/kendo.common.min.css" />
    <link rel="stylesheet" href="/lib/telerik.kendo-ui/css/kendo.common-bootstrap.min.css" />
    <link rel="stylesheet" href="/lib/telerik.kendo-ui/css/kendo.bootstrap.min.css" />
    <link rel="stylesheet" href="/lib/telerik.kendo-ui/css/kendo.bootstrap.mobile.min.css" />

    <script src="/lib/jquery/jquery.min.js" asp-append-version="true"></script>
    <script src="/lib/telerik.kendo-ui/js/kendo.all.min.js"></script>
    <script src="/lib/telerik.reporting/telerikReportViewer-14.0.20.115.min.js"></script>
    <script src="/lib/telerik.reporting/telerikReportViewer.kendo-14.0.20.115.min.js"></script>

    <style>
        #reportViewer1 {
            position: absolute;
            left: 5px;
            right: 5px;
            top: 50px;
            bottom: 5px;
            overflow: hidden;
            font-family: Verdana, Arial;
        }
    </style>
</head>

<body>
    <div class="row">
        <a href="/">Go Home</a>
    </div>
    <div id="reportViewer1">
        loading...
    </div>

    <div id="ddd"></div>

    <script type="text/javascript">
        $(document).ready(function () {
            $("#ddd").kendoGrid({
                dataSource: {
                    type: "odata",
                    transport: {
                        read: "https://demos.telerik.com/kendo-ui/service/Northwind.svc/Customers"
                    },
                    pageSize: 20
                },
                height: 550,
                groupable: true,
                sortable: true,
                pageable: {
                    refresh: true,
                    pageSizes: true,
                    buttonCount: 5
                },
                columns: [{
                    template: "<div class='customer-photo'" +
                        "style='background-image: url(../content/web/Customers/#:data.CustomerID#.jpg);'></div>" +
                        "<div class='customer-name'>#: ContactName #</div>",
                    field: "ContactName",
                    title: "Contact Name",
                    width: 240
                }, {
                    field: "ContactTitle",
                    title: "Contact Title"
                }, {
                    field: "CompanyName",
                    title: "Company Name"
                }, {
                    field: "Country",
                    width: 150
                }]
            });

            $("#reportViewer1")
                .telerik_ReportViewer({
                    serviceUrl: 'https://localhost:44388/api/reports/',

                //ReportSource - report description
                reportSource: {

                    // The report can be set to a report file name
                    // or CLR type name (report class definition).
                    report: "Barcodes Report.trdp",

                        // Parameters name value dictionary
                        parameters: {
                            CompanyId: 1,
                            PatientId: 1
                        }
                },

                viewMode: telerikReportViewer.ViewModes.INTERACTIVE,

                scaleMode: telerikReportViewer.ScaleModes.SPECIFIC,

                scale: 1.0
            });
    });
    </script>
</body>
</html>
Vitaliy
Top achievements
Rank 1
 answered on 18 Feb 2020
18 answers
988 views

When using IE, the print button does not work at all. Nothing happens.

In Edge, the print button initiates an export to PDF which provides the option to save the file or open it in Reader.

In Chrome, the button works as expected opening an Adobe print dialog.

Are there settings in the browser preventing the system print dialog? Is there some setting in the Report Viewer I can modify to make this work uniformly across all 3 browsers?

 

 

Neli
Telerik team
 answered on 18 Feb 2020
1 answer
564 views

I have been researching all day I can't find a solution.  I have tried to build a custom resolver to change the server name and port as a test.  I have coded this class it returns null because I cannot determine how to return a ReportSource.

public class TexasProtaxCustomReportResolver : Telerik.Reporting.Services.Engine.IReportResolver
    {
        public Telerik.Reporting.ReportSource Resolve(string reportName)
        {
            var reportPacker = new ReportPackager();
            using (var sourceStream = System.IO.File.OpenRead(reportName))
            {
                var report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream);
                var webServiceDataSource = (WebServiceDataSource)report.DataSource;
                string url = webServiceDataSource.ServiceUrl;
                url = url.ToLower().Replace("localhost:5001", "localhost:44384");
                webServiceDataSource.ServiceUrl = url;
               
                return null;
            }

        }
    }

In the ReportsConttroller I have tried adding the resolver but it has an error:

        public ReportsController(ConfigurationService configSvc)
        {
            this.reportsPath = Path.Combine(configSvc.Environment.WebRootPath, "Reports");

            this.ReportServiceConfiguration = new ReportServiceConfiguration
            {
                ReportingEngineConfiguration = configSvc.Configuration,
                HostAppId = "ReportsService",
                Storage = new FileStorage(),
                ReportResolver = new ReportTypeResolver()
                        .AddFallbackResolver(new ReportFileResolver(this.reportsPath))
                            .AddFallbackResolver(new TexasProtaxCustomReportResolver())
            };
        }

 

Any assistance would be appreciated.

Carlos
Top achievements
Rank 1
 answered on 18 Feb 2020
6 answers
1.4K+ views

Hi

I am attempting to get trdp files to generate a pdf in a .net core application using ObjectDataSource.

in my appsettings I have the following code to reference my dll.

"telerikReporting": {
   "assemblyReferences": [
     {
       "name": "Goalie.Shared",
       "version": "1.0.0.0",
       "culture": "neutral",
       "publicKeyToken": "null"
     }
   ]
 }

 

running the report results in error The assembly "EXTERNAL_ASSEMBLY_TYPE" is not permitted to be used by an ObjectDataSource component. Please include it in an AssemblyReferences element in the Telerik.Reporting configuration section of your application configuration file.

 

But when I put in a app.config as suggested https://www.telerik.com/forums/reporting-asp-net-core-rest-service-configuration#f0fajfr44E6tvOjTRMr33g

 

<?xml version ="1.0"?>
<configuration>
  <configSections>
    <section
                name="Telerik.Reporting"
                type="Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting"
                allowLocation="true"
                allowDefinition="Everywhere"/>
  </configSections>
  <Telerik.Reporting>
    <AssemblyReferences>
      <add name="Goalie.Shared" version="1.0.0.0" />
    </AssemblyReferences>
  </Telerik.Reporting>
</configuration>

 

everything works fine. 

 

Should we still need this step? What are the requirements so that the telerikReporting section of the appsettings.json are read? I have made sure all of the dlls are installed as specified here https://docs.telerik.com/reporting/use-reports-in-net-core-apps

Its not a big deal but seems un-nessesary. Any ideas?

 

Todor
Telerik team
 answered on 18 Feb 2020
6 answers
469 views

I feel like I'm going mad.

We have an ASP.NET Core 2.2 app running for a client in an Azure app service. There is a single large report used within the application which, with 3 sub reports included, produces a 7 page report output. All report design files are stored as .trdp including the sub-reports. The report files are all hosted in the wwwroot\Reports folder together. I have some minor problems in the reports where some textboxes are not displaying the correct information or in one case has a typo. I've corrected all the issues in my copy of the .trdp files and I've published the entire app via VS 2017 to the Azure app service and the reports haven't changed. I've connected to Azure via FTP and manually deleted the report files and if I then run the report in the web app it tells me it can't find the report file correctly - likewise if I just delete the report file for a sub-report then the main report displays but there is an error where the sub-report should be. I re-upload my local version of the report file I'd deleted and run the report through the web app and again the report displays without errors but it still displays the previous version of the report. The report has a company logo in the header of every page of the report. If I delete the logo from my version of the report and copy that over via FTP, when I run the report the logo has gone from the report but the text is still wrong.The typo I have corrected is to change the word "clumn" to the correct spelling "column" but every time the word appears in the report missing the 'o'. I have some other textboxes that concatenate text with field values and I've had to change the fields being used or had to add additional field values together and they are not changing, the text continuing to show the previous incorrect values.

Help! What the hell is going on here? What am I missing? How can I remove a logo from the trdp file and the report displays without the logo but still shows the incorrect textboxes throughout the report? What do I need to do to make the report (and sub-reports) pick up the correct report files? I've restarted the Azure app service and shut it down completely then started it again. I've used 2 different browsers but still I get the same symptoms. I urgently need some advice to help me get to the bottom of this. The application should be live this week but can't be without the report being absolutely accurate which it currently is not.

Thanks in advance for any and all advice

PaulH
Top achievements
Rank 1
 answered on 17 Feb 2020
1 answer
246 views

Hello all,

Is there a way to get Telerik reports old version files ( Should .net framework 2.0 ) .? One of my client has GP10 version and we did a Add-in project  for GP  .

In that project we need to run report . I have latest controls ( .Net framework 4.5 and above ) but those are not accept in GP10 . 

Can anybody help me how to get .net framework 2.0 telerik assembly files and How can i run the report using vb.net windows form.

 

 

 

Thanks

Victor Athoti.

Eric R | Senior Technical Support Engineer
Telerik team
 answered on 17 Feb 2020
1 answer
63 views
I have a website that I need to move from a Windows 2008 server to a Windows 2019 server.  I have moved the website to the new server without issues, however the pages that have Telerik Reporting on these are not working.  It will not run a report and just gives an error.

I have never seen Telerik before and this is from an existing IT director, but I am wondering if I have to do anything on the new server in order to get the reports to work on my new web server.

Any assistance would be greatly appreciated.
Neli
Telerik team
 answered on 17 Feb 2020
1 answer
121 views

I have some thing like this

COL1    COL2
a            1
b            2
c            3
d            4

              4 =====> this is what im asking for

I want to get last item of the row.. I have been using sum and its helpful but this time I want to get the last item. how do I do that?

Neli
Telerik team
 answered on 17 Feb 2020
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?