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

Silverlight Application - Get reports from folder

5 Answers 95 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
ChepA
Top achievements
Rank 1
ChepA asked on 25 Feb 2015, 02:10 PM
Hi, i'm developing a Silverlight solution that use ReportView. In my mind, ill create reports on stand alone Report Designer and save the .trdx files on specific folder. Using a default  Report Resolver, i didn't find how to do this. So, i created a custom Report Resolver like on Telerik Report Documentation. Perfect, the report viewer could connect with my ReportService using my custom resolver BUT, i don't know how to deal with it. There is no pratical example of it. Here is the code of my custom report resolver, it works partially, because it gets the report, send and on the report viewer didn't show.

namespace Services.Code_Test
{
    using Telerik.Reporting.Service;
    using Telerik.Reporting;
    using System.IO;

    public class CustomReportService : ReportService
    {
        static readonly IReportResolver resolver = new ReportResolver();

        public CustomReportService()
        {
            this.ReportResolver = resolver;
        }
    }

    public class ReportResolver : IReportResolver
    {
        public ReportSource Resolve(string report)
        {
            string path = string.Format(@"D:\Reports\{0}.trdx", report);
            UriReportSource uriReportSource = new UriReportSource();
             uriReportSource.Uri = report;
            return uriReportSource;
        }
    }
}

What i am doing wrong?

5 Answers, 1 is accepted

Sort by
0
Accepted
Stef
Telerik team
answered on 02 Mar 2015, 12:23 PM
Hi ChepA,

You do not need a custom report resolver for the Reporting WCf service, when you want to display TRDX files without modifications.

The viewer sends a string description of the report that has to be resolved and rendered (ReportViewer.Report property). If this string description contains a report type's assembly qualified name or a path to a TRDX file, the service will handle the resolving without additional settings.
The only requirement is:
  1. The assembly with the reports to be loaded in the domain of the service (add reference to the reports' project);
  2. If the TRDX file is specified via relative path, the path will be resolved based on the service's project execution folder.


On a side note, if you are still interested in working with custom report resolvers, please go through my colleague's explanation in this forum post.


I hope the provided information is helpful.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
ChepA
Top achievements
Rank 1
answered on 02 Mar 2015, 01:14 PM
Thanks Stef, I will try this this week and as soon as possible i will say to you what happens.
0
ChepA
Top achievements
Rank 1
answered on 11 Mar 2015, 02:06 PM
Hail Stef, it works perfectly.
Now i need to discovery how to set a connection string when i'm Resolving the report.
Another question: It brings my report as i wished, but, i couldn't  export nor print. There is something to do different?

Regards,
Tiago
0
ChepA
Top achievements
Rank 1
answered on 12 Mar 2015, 08:29 PM
So Stef, i'm doing well, i can change the conectionstring on the fly and then send the Report URI, but i want to do something different.
Instead send report uri, i want to read the Report.trdx, include connectionstring and then send it on the fly. I don't want to save the Report on disk with its connection string. Is it possible?
0
Stef
Telerik team
answered on 16 Mar 2015, 11:26 AM
Hello ChepA,

To display a report in the Silverlight ReportViewer it must be resolved by a Reporting WCF service. The service works only with UriReportSource and TypeReportSource. Thus the implementation of the custom resolver must be considered with this design. In case of modifying a report, you will need it stored as TRDX (XML format) and passed to the viewer.

If it is an option, my recommendation is to use the HTML5 Report Viewer and the Reporting REST service. Examples with the viewer are available in the local Html5Demo and MvcDemo projects.
The linked overview articles elaborate how to use the viewer and the service.
The Reporting REST service works only with the HTML5 viewer, but allows you to work with any type of report source through the default resolvers or custom one - REST Service Report Resolver.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
ChepA
Top achievements
Rank 1
Answers by
Stef
Telerik team
ChepA
Top achievements
Rank 1
Share this question
or