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

Where to start?

7 Answers 51 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 10 Dec 2015, 04:29 AM

I have read the documentation end to end and I have no idea how to use the Reporting tool.  Maybe my application is not a good fit for this tool.  Let me describe what I am trying to do.

 

I have a C#/MVC web application that simulates a report designer. The user can pick Key Performance Indicators (KPIs) from a list and save the report.  Then I would like to use the Telerik.Reporting to display a report based on these dynamic KPIs.  Then each value on the report is clickable to drill into a different view of the report.

 

I have been searching through all the documentation and I keep seeing references to use the ReportDesigner in Visual Studio which I don't want to do since each report is dynamic to the number and types of KPIs.

 

Am I looking at this wrong?

7 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 10 Dec 2015, 02:01 PM
Hello Jeff,

Your MVC application already serves the role of a report designer, so your users won't need to use the Visual Studio Report Designer.
What you need to do to display a report based on your dynamic KPIs is create the report programmatically, based on the chosen report layout and KPIs in your MVC application. To create the report programmatically, you can use the Reporting API Reference and the Programmatic Control of Reports help articles.

Regards,
Nasko
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
0
Jeff
Top achievements
Rank 1
answered on 10 Dec 2015, 03:22 PM

I really appreciate your reply.

 I have read that article you recommended for me:

http://docs.telerik.com/reporting/programmatic-creating-report

What I don't understand is how to get that DataSource to:

 @(Html.TelerikReporting().ReportViewer()

I can model bind the DataSource but not sure how to get it to the TelerikReporting ReportViewer.

0
Stef
Telerik team
answered on 10 Dec 2015, 04:20 PM
Hi Jeff,

When you use the HTML5 viewer, all changes on report's settings must be applied on the server. The viewer is only a client-side widget which sends requests for getting resources which the services handles on the server (you cannot transfer whole report or data objects through the viewer).

Thus data objects can be set:
  1. By saving the user selection on the server. Then the report can pull the data via data source component e.g. ObjectDataSource component. This is a recommended approach.
  2. By using a custom report resolver for the Reporting REST service. The resolver's Resolve method receives the string description of the report, and you will have to handle it in code - get a Telerik.Reporting.Report instance and modify its settings.
    Please check this post for further details.
  3. By using the report's NeedDataSource event to supply the data.

The approach depends on how data is handled in the application.


In case you are starting with Telerik Reporting, please check this forum thread.

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
0
Jeff
Top achievements
Rank 1
answered on 10 Dec 2015, 05:10 PM

I totally understand but something is not quite right.

Here is my controller:

01.public ActionResult StandardReport(int reportId)
02.{
03.    // ToDo: validate that this user has access to this report
04. 
05.    // Creating and configuring the ObjectDataSource component:
06.    Telerik.Reporting.ObjectDataSource objectDataSource = new Telerik.Reporting.ObjectDataSource();
07.    objectDataSource.DataSource = GetData(); // GetData returns a DataTable
08. 
09.    // Creating a new report
10.    Telerik.Reporting.Report report = new Telerik.Reporting.Report();
11. 
12.    // Assigning the ObjectDataSource component to the DataSource property of the report.
13.    report.DataSource = objectDataSource;
14. 
15.    // Use the InstanceReportSource to pass the report to the viewer for displaying
16.    Telerik.Reporting.InstanceReportSource reportSource = new Telerik.Reporting.InstanceReportSource();
17.    reportSource.ReportDocument = report;
18. 
19.    return View(reportSource);
20.}
21. 
22.static DataTable GetData()
23.{
24.    string selectCommandText = "SELECT * FROM [dbo].[reportWizardKPI];";
25. 
26.    SqlDataAdapter dataAdapter = new SqlDataAdapter(selectCommandText, Utilities.GetCompanyConnectionString("1"));
27.    DataTable dataTable = new DataTable();
28. 
29.    dataAdapter.Fill(dataTable);
30. 
31.    return dataTable;
32.}

And my view:

01.@model Telerik.Reporting.InstanceReportSource
02. 
03.@(Html.TelerikReporting().ReportViewer()
04.    .Id("reportViewer1")
05.    .ServiceUrl(Url.Content("/api/reports/"))
06.    .ReportSource(Model)
07.    .ViewMode(ViewMode.Interactive)
08.    .ScaleMode(ScaleMode.Specific)
09.    .Scale(1.0)
10.    .PersistSession(false)
11.    .PrintMode(PrintMode.AutoSelect)
12.)

The report view shows up blank with this error:

Unable to get report parameters.
Missing report name

Any ideas?

 

 

0
Jeff
Top achievements
Rank 1
answered on 11 Dec 2015, 05:09 AM

No matter what I do, I can't get this to work.  I can't display a simple SQL query to a report viewer.  :(

0
Jeff
Top achievements
Rank 1
answered on 11 Dec 2015, 01:52 PM
Can I get any pointers on this?  I really need to get this working.  I will send a support request again.
0
Stef
Telerik team
answered on 11 Dec 2015, 05:14 PM
Hello Jeff,

Telerik Reports are templates (objects inheriting Telerik.Reporting.Report). These templates can contain static data (TextBox items and others with directly set values) or data from fields of the assigned data source.
Please check  this forum thread to get started with designing reports.


Once the report is designed - has sections, items and assigned data source, you can modify it in code at run-time. This operation must be done on the server - in the Reporting REST service's resolver or in the report itself.
For the purpose:
  1. Design a report with any of the available Report Designers. You can use test data only to design the report layout.
  2. Add an HTML5 Viewer and Reporting REST service which can display the designed report.

    Steps 1 and 2 can be accomplished at once by using the VS item template for adding an HTML5 Viewer in a web application. The started wizard will ask you to use a sample report or to create a new one by starting a Report Wizard.

  3. Once you have a working project, you can proceed with adding a custom resolver for the Reporting REST service. The resolver's purpose is to allow you to change the data of the designed report at run-time, if needed. Consider the example in this forum post.



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