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

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

1 Answer 581 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 28 Oct 2015, 03:50 PM

Hi,

 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.

Thanks,

Daniel

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 29 Oct 2015, 03:55 PM
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.

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
Report Designer (standalone)
Asked by
Daniel
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or