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

dynamic sql query

1 Answer 308 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
pohvak
Top achievements
Rank 1
pohvak asked on 29 Sep 2008, 10:55 PM
hi, i had ready the telerik report but i need to change the query of the datasource to be dynamic, i mean, before the report is shown in web page the user uses some criteria to filter the report, is there any example of how i can do this?

1 Answer, 1 is accepted

Sort by
0
Kalina
Telerik team
answered on 30 Sep 2008, 11:27 AM
Hello pohvak,

The easiest and out-of-the-box approach to achieve interactivity in the report is to use Report Parameters  and Filters (see also Edit Filter Dialog). Combining these two features the data is retrieved once from the DB (or whatever data source you are using) and the filtering is applied in the report itself every time the user hits the Preview button.

If the amount of data is too big, you may choose different approach again using ReportParameters but sending the chosen/entered parameter values to the DB. This way you will have round trips to the DB each time Preview is hit and the filtering will be performed in the DB. Please review the KB article Using data source with parameters in Telerik Reporting on implementation details of this approach.

Finally you can make your own UI collecting the data from the user, retrieve the data based on the input in an appropriate data source (DataSet for example), and set this datasource tho the DataSource property of the report before the rendering process.

I hope you find that information helpful.

Sincerely yours,
Milen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
pohvak
Top achievements
Rank 1
Answers by
Kalina
Telerik team
Share this question
or