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

Silverlight ReportViewer - how to use a relative Report file name?

1 Answer 59 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Adrian
Top achievements
Rank 1
Adrian asked on 23 Apr 2013, 09:24 AM
Hi.

We have a Silverlight ReportViewer that talks to a WCF Report Service.

This report service looks implements "ApplicationPath" which according to its description should allow relative report file names when the silverlight viewer requests to render a report.

ReportingService : ReportServiceBase, IReportService
{
        private static string _applicationPath = null;
   
        /// <summary>
        /// From <see cref="Telerik.Reporting.ReportServiceBase"/>
        /// When implemented, returns the file system path of the current application's root directory.
        /// It is used to resolve the relative paths of the <see cref="Telerik.Reporting.UriReportSource"/>s.
        /// </summary>
        protected override string ApplicationPath
        {
            get
            {
                if (_applicationPath == null)
                {
                    _applicationPath = XXXX.Helpers.LoadExternal.GetReportsPath(); // This sets a FullName path like C:\ProgramData\OurProgram\Reports
                }
                return _applicationPath;
            }
        }
  
.....
}

Our silverlight reportview uses standard binding to the "Report" attribute

<telerikReporting:ReportViewer ReportServiceClientFactory="{Binding ReportServiceClientFactory}"
                                       ReportServiceUri="{Binding ReportServiceUrl}"
                                       Report="{Binding ReportName}"
                                       Visibility="{Binding ReportVisibility}" />

The report renders correctly when "ReportName" is

  • a fully qualified name that represents a report stored in a loaded dll on the server side
  • "C:\ProgramData\OurApp\Reports\MyReport.trdx" - a fullName file path for a report stored on the server file system

However, if we try to set "ReportName" to a relative path it fails. We have tried

  • MyReport.trdx
  • MyReport
  • ./MyReport.trdx

These produce a rendering error: 
A report can't be created from Barcodes Report.trdx

The "ApplicationPath" does not seem to get called.

I can confirm by calling it manually that the correct path is returned (and ends in a slash char) and that MyReport.trdx exists and it is a valid report at this location.

From Silverlight report viewer how are we meant to specify a relative file path?

We would like to be able to specify only a relative path from Silverlight to not give away the full server path in any server communication.

Is this possible?

Looking at ReportFileResolver code it is not, so do we have to create a custom resolver or is this a possible feature for future versions?

Thanks.

Adrian.

1 Answer, 1 is accepted

Sort by
0
Chavdar
Telerik team
answered on 25 Apr 2013, 04:03 PM
Hi,

Thank you for reporting this issue.

Indeed, the WCF service does not use the value of the ApplicationPath property when resolving the relative path of a report during the first request. For now the reports should be placed in a relative to the web application's root directory. We will log this problem in our bug database and fix it accordingly.

Meanwhile you can workaround this issue by implementing a custom report resolver as described in the How to: Implement and use custom IReportResolver help article.

Your Telerik Points have been updated for bringing the problem to our attention.

All the best,
Chavdar
the Telerik team

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

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