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

adding parameters to dynamic object datasource

7 Answers 758 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
haseeb
Top achievements
Rank 1
haseeb asked on 26 Dec 2016, 05:45 AM

i followed the attachment in this post to create an object datasource. now i have to pass ten parameters into the datasource for getting some data from a query with almost one billion rows if not applied parameters. since i need to reuse existing infrastructure i have to use the method in our data layer project to get data. so adding dynamic object datasource is a must. how will i pass these parameters to the object datasource

also i would like to know if there is any way to pass all these 10 parameters as a model so i can forward the model from our webapi controller?

7 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 26 Dec 2016, 11:15 AM
Hi haseeb,

Reports are processed and rendered on the server.
You can modify data via custom UI that saves the changes on the server. Then you can add data access layer with method filtering data on retrieval to avoid loading all records at once - Filtering data. the parameterized data retrieval method can have arguments of String, Integer, Boolean, Float, DateTime type which can be mapped to report parameters - Using Parameters with the ObjectDataSource Component. Custom data types are not supported by report parameters.

Regards,
Stef
Telerik by Progress
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
0
haseeb
Top achievements
Rank 1
answered on 26 Dec 2016, 11:27 AM

now another question is ,

1) how to forward report parameters to data source

2) how can i receive this data in the dynamic datasource created as per the example attached here

0
Stef
Telerik team
answered on 26 Dec 2016, 12:47 PM
Hi haseeb,

The provided example illustrates the properties of the ObjectDataSource component.
Please check Do I need to use a Data Source component?:
"the purpose of the ObjectDataSource component is to provide data to the report in a declarative manner. The ObjectDataSource.DataSource property should be the assembly qualified name or Type of the data access layer (class), The Reporting engine will use System.Reflection to create an instance of the class by using its default constructor, and to execute its method specified by the ObjectDataSource.DataMember property. "

Having the above into account, data should be saved on the server machine, where on processing a report it will be able to get its data. Parameters can be sent to the data-retrieval method by mapping the data-retrieval method's arguments to report parameters - How To: Pass Values to Report Parameters.

Regards,
Stef
Telerik by Progress
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
0
haseeb
Top achievements
Rank 1
answered on 26 Dec 2016, 01:04 PM

thanks stef,

then how can i get data using our existing data access method created for web api.

memberData.getPerClient() is a function which retrieved data using entity framework and gives member data per client as a list. i want to pass this returned data into our report library.

0
Stef
Telerik team
answered on 26 Dec 2016, 04:37 PM
Hi haseeb,

In MVC context a model instance is created and transferred back and forth between views and controllers.

The HTML5 Viewer and Reporting REST service does not use MVC, but a client-server model. The viewer does not submit whole data objects to the server, it sends only short JSON formatted messages directing the Reporting REST service what resources to be produced on the server.

You will need to save changes from your model on the server, and let the report get the data from the server, not the current data context instance and its methods that is used by the MVC project. Other approach is to test accessing the current data context in the report's NeedDataSource event.

Regards,
Stef
Telerik by Progress
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
0
Biplov
Top achievements
Rank 1
answered on 08 Mar 2020, 03:13 AM

Hi Admin,

I am using Telerik MVC application. We have requirement that user will click a button in Page1 and sent "manufacturer" as parameter to Page2 (redirection).

The parameters can be sent in any one: 

a) Pass data as query string parameters
b) Pass data in TempData dictionary
c) Pass data as route parameters

Page2 is having ReportViewer with "ListBoundReport" as report template and whose report source is objectDataSource having "Cars" list as datasource. Enduser wants that when the Page2 will load it will show only the cars having manufacture sent from Page1.

Ideally we want to pass that "manufacture" parameter in "ListBoundReport" report datasource before it will load to ReportViewer.

Kindly suggest how to achieve this

0
Todor
Telerik team
answered on 11 Mar 2020, 05:04 PM

Hello Biplov,

You need to create a Report Parameter specifying the manufacturer and link it to an ObjectDataSource parameter. Hence, you need also to make a constructor of Cars that takes as an argument the manufacturer and returns only the records for this manufacturer. If the ObjectDataSource has a DataMember you need to add the parameter to the DataMember method and leave the constructor parameterless. More details can be found in Using Parameters with the ObjectDataSource Component.

In the viewer, you need to specify the value for the manufacturer parameter in the client-side reportSource -> 'parameters' collection. This value will be automatically passed as value for the Report Parameter and then to the ObjectDataSource parameter.

Regards,
Todor
Progress 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
General Discussions
Asked by
haseeb
Top achievements
Rank 1
Answers by
Stef
Telerik team
haseeb
Top achievements
Rank 1
Biplov
Top achievements
Rank 1
Todor
Telerik team
Share this question
or