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

How to set the data to report from REST API.

1 Answer 292 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Vikram
Top achievements
Rank 1
Vikram asked on 05 Dec 2016, 07:12 AM

I need to show telerik report with some table, images and chart. The data for report is coming from REST API. This report needs to be severed from MVC application.

I designed report from standalone designer (.trdx) file and used as CSV data source (File location provided as Url of MVC App) into the report. Used this report file in MVC application to show in report viewer. This works fine, but I have one problem there, I have filter field (Report Parameters) of type String with Multivalue with following values:

- This week

- Last week

- Last month

Based on this selection value, I need to fetch report data from REST service and need to convert this report data into CSV. To achieve this I need to get the filter value in backend when user clicks on preview button of report. I am not able to find a way to do this, I checked examples comes with reporting installation but not able to find a way there. Does anyone know how to achieve this?

Another question is, does CSVDataSource component is good choice, or need to switch to Object Data Source as most of video's recommend that. If yes the how to get the parameter value in the class.

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 05 Dec 2016, 05:24 PM
Hello Vikram,

The first two approaches I can think of are:
  1. Use a custom UI to display filters and gather the user selection. This will let you filter the data and save it in an CSV that will be used by the report;
  2. Use report parameters and change the data source to an Object/EntityDataSource e.g. Connecting Telerik Reporting to OData feeds. To bind data, you will have to build a data access layer in a separate assembly that can extend the Standalone Report Designer - Extending Report Designer, and the application that will display the report - Previewing a report definition that uses an external assembly.

Other approaches will be to use a custom resolver for the Reporting REST service allowing you to deserialize the report and update all data items' DataSource properties e.g. this forum dicussion, or to use a custom resolver to fetch information sent by the viewer (the reportSource.report string, parameters are not available in the resolver's Resolve method). The issue will be that the custom resolver is called multiple times on requesting a report, applying parameters, refresh of the viewer, export, print operations and navigation between reports.


Let us know if you need further help.

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
Tags
General Discussions
Asked by
Vikram
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or