Report DataSource

5 posts, 0 answers
  1. G-Man
    G-Man avatar
    6 posts
    Member since:
    Sep 2009

    Posted 13 Oct 2013 Link to this post


    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?

  2. Method
    Method avatar
    8 posts
    Member since:
    Jul 2012

    Posted 25 Oct 2013 Link to this post

    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. 
  3. Milen
    Milen avatar
    181 posts

    Posted 30 Oct 2013 Link to this post


    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.

  4. Grant
    Grant avatar
    12 posts
    Member since:
    Aug 2011

    Posted 23 Jun 2016 Link to this post

    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
  5. Stef
    Stef avatar
    3610 posts

    Posted 27 Jun 2016 Link to this post

    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.

    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
Back to Top