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

Report DataSource

4 Answers 1396 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
G-Man
Top achievements
Rank 1
G-Man asked on 13 Oct 2013, 11:14 PM
Hi,

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?

Thanks.

4 Answers, 1 is accepted

Sort by
0
Method
Top achievements
Rank 1
answered on 25 Oct 2013, 12:31 PM
Hi.
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. 
0
Milen | Product Manager @DX
Telerik team
answered on 30 Oct 2013, 02:51 PM
Hello,

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.

Regards,
Milen
Telerik

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

0
Ian
Top achievements
Rank 1
answered on 24 Jun 2016, 12:17 AM

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:

 

Dim report As Telerik.Reporting.Report = DirectCast(xmlSerializer.Deserialize(xmlReader), Telerik.Reporting.Report)
report.DataSource = GetData(strSRDID) 
 
 
Shared Function GetData(strSRDID As String) As IDataAdapter
        Dim connectionString As String = ConfigurationManager.ConnectionStrings("BOSTradeConnectionString").ToString
        Dim selectCommandText As String = "SELECT fLoadSortStringText_1.SortString, dbo.tblScaleData.* FROM dbo.tblScaleData INNER JOIN dbo.fLoadSortStringText() AS fLoadSortStringText_1 ON dbo.tblScaleData.SRDID = fLoadSortStringText_1.SRDID WHERE (dbo.tblScaleData.SRDID IN ( " & strSRDID & "))"
        'Dim selectCommandText As String = "select * from fLoadSortStringTable(" & strSRDID & ")"
        Return New SqlDataAdapter(selectCommandText, connectionString)
End Function
0
Stef
Telerik team
answered on 27 Jun 2016, 08:28 AM
Hi Grant,

Data retrieved in the illustrated manner can be wrapped by an ObjectDataSource component, where the strSRDID 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.

Regards,
Stef
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
G-Man
Top achievements
Rank 1
Answers by
Method
Top achievements
Rank 1
Milen | Product Manager @DX
Telerik team
Ian
Top achievements
Rank 1
Stef
Telerik team
Share this question
or