ObjectDataSource pass parameter to query

1 Answer 65 Views
DataSource Object Report Parameters
n/a
Top achievements
Rank 1
Iron
Iron
n/a asked on 05 Oct 2022, 10:01 AM

Hello there,

I have used Solution 2 from the below link, to print the nested data.

https://docs.telerik.com/reporting/knowledge-base/hierarchical-report-from-nested-data

Here an object is created in code behind with query. my question how can i pass parameter to this sql query. QueryString, Session is not accessible here.

Please advice.

 

n/a
Top achievements
Rank 1
Iron
Iron
commented on 07 Oct 2022, 09:50 AM

Hello can anyone suggest?!

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 10 Oct 2022, 08:34 AM

Hello Alruya,

If I understood correctly, you use the approach described in the forum post How do I display recursive data? You need to pass a parameter to the query from the Session.

In the updated sample for the approach, I see that the report DataSource is assigned in the code behind. Generally, this requires modification of the report definition and thus its instantiation during the runtime. If you use a Html5-based viewer or a desktop viewer connected to a Telerik Reporting REST Service, you may do this in a custom ReportSource resolver. The session should also be available there.

Alternatively, you may use the approach from the KB How to Use a Single SQL DataSet in Master-Detail scenario. This should let you fetch data from the MSSQL database with nested data sets in JSON format and utilize the first approach from the KB How to Create a Report that Displays Hierarchical Nested Data. If you use a different database, you may check whether it supports similar options.

Note that you may pass the data to the report also from a Web Service through our WebServiceDataSource component. This won't require report to be instantiated in runtime, which may make your project easier for maintenance in its Reporting part.

Regards,
Todor
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
n/a
Top achievements
Rank 1
Iron
Iron
commented on 19 Oct 2022, 10:52 AM

Thank you, i think i will switch using WebServiceDataSource component.
Tags
DataSource Object Report Parameters
Asked by
n/a
Top achievements
Rank 1
Iron
Iron
Answers by
Todor
Telerik team
Share this question
or