Pass DataSource Query as a Variable in Telerik Report(TRDXfile)

2 posts, 0 answers
  1. Daniel
    Daniel avatar
    4 posts
    Member since:
    Oct 2015

    Posted 28 Oct 2015 Link to this post


     We are trying to pass the data source query for the Telerik report as a parameter, at present we have option to build data source query during report creation in stand alone designer and the query is hardcoded inside the report(trdx file) when viewed from report designer or dot net application.


    But we want to build the source query filters at run time in dot net application and pass them to the Telerik reports. I had raised a support ticket for this but haven't got an update from them, please share if you have some pointers to achieve this.



  2. Stef
    Stef avatar
    3611 posts

    Posted 29 Oct 2015 Link to this post

    Hi Daniel,

    Below is quote from my response in your support ticket on the same question:
    "If the filters will be applied in the data retrieval method, you can create a dynamic SQL query based on string passed as a report parameter. Consider the example under Dynamic SQL in a Stored Procedure (code project post).

    Other approach is to implement a custom data access layer, which retrieves data based on the user input. The code will have to be built in a separate assembly (DLL) which extends the Standalone Designer tool. Report parameters can be used to pass the user selection to the data access layer.

    If you prefer to modify a designed report at run-time, the approach is to get a report instance by  deserializing the TRDX file's content. Then you can iterate the report's Items collection and modify all data items' DataSource properties. Consider the example in Changing the connection string dynamically according to runtime data.

    If you have any further questions, please let us continue the discussion in one of both threads.

    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