I need the reports to pass through layers of security which has already been set up in our own BaseController and therefore I need to set the DataSource of the report programmatically.
How can I do this with your MVC report tool as well as being able to pass through parameters? Alternatively, can I change the WebAPI url so it points to our own WebAPI functions?
4 Answers, 1 is accepted
I'm having the same problem, need set the DataSource programmatically.
I set the dataSource in the function CreateReportResolver in ReportsControllerBase, but dont show nothing in the DataSource in execution.
The supported report sources are listed in the jQuery.fn.telerik_ReportViewer(options) help article.
You can use TypeReportSource and pass reports to the HTML5 Report Viewer via assembly qualified name or use UriReportSource and pass the report path. Both support ObjectDataSource which may receive parameters and may contain all the necessary custom logic you have to implement on order to return the correct data.
InstanceReportSource (i.e., live modified report object) is not supported because of the specifics of the REST service scenario where there is no live session state that keeps live objects between the resource requests.
For more information how to pass parameters to your reports look at the HTML5 Report Viewer article How To: Pass values to report parameters help article.
Let us know if you have any further questions.
Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.
This answers the question of how to set the report source. i.e. "SampleReport.trdp"
The original question was how to change the DataSource of a report. As in SQL command etc... There is no documentation of this for the newer HTML5 report viewer.
Example under the old reporting system:
Data retrieved in the illustrated manner can be wrapped by an ObjectDataSource component, where the
argument can be mapped to a report parameter e.g. Using Parameters with the ObjectDataSource Component. Then you can pass different values to the method by updating the report parameter through the viewer's ReportSource.Parameters collection which is mapped by key (Name) to the report's ReportParameters collection.
To use an ObjectDataSource in the Standalone Report Designer, you will need to extend the tool - Extending Report Designer. The tutorials linked at the bottom elaborate on the settings required by the Standalone Report Designer and the application with the viewer.
If you prefer to set the data at run-time, you will need a custom resolver for the Reporting REST service as reports are processed and resolved on the server where the Reporting REST service is running. Please consider the example here. Note the the resolver is used frequently on interaction with the report, and initially it is called 2-3 times for registering the viewer, resolving the report and getting a list of parameters.
Other approach for VS reports is to use the report's NeedDataSource event to supply the data. Running parameters' values can be obtained through the processing report.
I hope this information is helpful.