Silverlight Application - Get reports from folder

6 posts, 1 answers
  1. ChepA
    ChepA avatar
    10 posts
    Member since:
    Jan 2014

    Posted 25 Feb 2015 Link to this post

    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?
  2. Answer
    Stef
    Admin
    Stef avatar
    3610 posts

    Posted 02 Mar 2015 Link to this post

    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.

     
  3. ChepA
    ChepA avatar
    10 posts
    Member since:
    Jan 2014

    Posted 02 Mar 2015 in reply to Stef Link to this post

    Thanks Stef, I will try this this week and as soon as possible i will say to you what happens.
  4. ChepA
    ChepA avatar
    10 posts
    Member since:
    Jan 2014

    Posted 11 Mar 2015 in reply to Stef Link to this post

    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
  5. ChepA
    ChepA avatar
    10 posts
    Member since:
    Jan 2014

    Posted 12 Mar 2015 in reply to Stef Link to this post

    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?
  6. Stef
    Admin
    Stef avatar
    3610 posts

    Posted 16 Mar 2015 Link to this post

    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.

     
Back to Top