I'm trying to emebbed a report viewer in a Silverlight Web application. I've got a reportviewer object in a window and the empty template of my first report loads normally. The problem started with the data population. I need to change some parameters and retrive the data by a WCF service. My first thought was to change the reportViewer.DataContext to pass an ObservableCollection or a list to the report with the data from my service. But it didn't work.
My second thought is to change dinamically the reportviewer.ReportServiceUri, so I've dessigned a litle REST WFC service (asking for /GiveMeReport/Report1 retreives the Report1, using /GiveMeReport/Report2 the second one,etc. and in the reportviewer change the Uri using Urls like ReportServiceUri=http://localhost/Service.svc/GiveMeReport/Report1). I don't know if this is possible but I just started mounting this WCF service and spent 2hours looking for documentation to do this and I didn't find anything. Do I have to send a Telerik.Reporting.Service.Report or a stream? How to implement IReportService and IResourceService?
Can you please send me a link with documentation or a code sample?
I really appreciate your help. Thank you.
9 Answers, 1 is accepted
Any news about this...?
As the Silverlight Report Viewer runs on the client and the reports are on the server, you cannot create a report object in your Silverlight application. The remote access to the Telerik Reporting Engine is accomplished via Telerik Reporting Service, which acts as a communication interface between the client programs and the report server. So the only way to pass values to your report parameters is via the RenderBegin eventhandler of the report viewer. For more information refer to: Programmatic Initialization of Report Parameter Values in Telerik Reporting Silverlight Viewer.
You can find documentation about the Telerik Reporting WCF service (which is a standard WCF service) in the following articles:
Also the following blog post should guide you in the correct direction:Using Telerik Reporting with WCF RIA Services.
We don't understand the requirements for changing the ReportServiceUri dynamically. This property of the viewer specifies the location of the report service - absolute or relative Uri. To change reports dynamically you should use the ReportViewer.Report property. The Telerik Reporting WCF service includes default report resolvers that are capable to resolve IReportDocument from relative and physical path that points to trdx file (report definition serialized in XML) or from assembly qualified name. Should you need something custom, you might refer to this blog post: Extending Telerik Reporting Service with Custom IReportResolver.Kind regards,
the Telerik team
we've read all the information you sent and also tested it (by the way, the extending Telerik Reporting Service with Custom IReportResolver doesn't compile...), but we haven't found yet what we need.
Summarizing the situation, the architecture of our applicattion is simple: a server and many silverlight clients asking for data through a wcf http or https connection. So the main idea is a WCF service with the reports stored which responds to a report viewer (not a self-hosted wcf server).
At the end we are looking for a wcf service which depending on the received string has to process some stored procedures or anothers in a database, then populate a selected report with the resuls and finally send it to the silverlight client (in my vs project wcf is stored in an IIS and referenced in the silverlight project as an external reference, so there are two different projects).
The question: is it possible to overwrite the method that responds to the reportviewer to make it check some variables in the server, populate a document with data and serve the document to a client? If this scenario is possible, could you provice a little sample? By far, we've been working 2days with Telerik's documentation and trying to execute your CustomReportService without success.
Generally custom IReportResolver is recommended when you keep your report definitions in a database or another storage different from the file system and you keep the report definitions serialized in XML. Still if you have more special requirements for customization that are not covered with report parameters you can use the IReportResolver. If this is the case check out the attached sample.
However if you just need to pass some report parameters to the report definition and accordingly to the datasource, you can use the approach elaborated in Programmatic Initialization of Report Parameter Values in Telerik Reporting Silverlight Viewer.
the Telerik team
I tried your attached sample but the parameters I assigned were not passed from the viewer to the report.
I'm passing parameters this way:
Note : I read Programmatic Initialization of Report Parameter Values in Telerik Reporting Silverlight Viewer .
The supported report parameters' types are String, Integer, Float, Boolean and DateTime. Passing arrays of objects and custom types is not supported. Try passing the index of the objects or the serialized into string custom object.
I hope this points you into the right direction.
First of all ,thanks for replying my question.
I changed parameter passing ,according to your comments, with the following.
But again I received empty parameters.
Would you please run this code from your environment?
The Car1, Car2, ModelYear report parameters should have been added to the report definition in order the code snippet to work. Then they will be mapped by name to the passed collection of values in the ReportViewer.RenderBegin event, and their running values will be in the processing report Parameters collection.