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

Angular Report Viewer in app housed in .NET MVC

3 Answers 116 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Justin
Top achievements
Rank 1
Justin asked on 22 Aug 2017, 06:09 PM

I am currently developing a reporting app with Angular. This app is housed in .NET MVC architecture due to the constraints I must work within. In order to keep my data access tier from knowing anything about the reports themselves, I have a separate DatabaseManager that makes my queries and returns the results in a business object. My angular front-end gets the query parameters from the user, makes the rest call to an MVC ApiController. 

My question is this: how do I take the business object and display the data in the report within the angular app? I have the angular report viewer in my component html. On the back-end, I can create an instance of the report I made in the designer, set it's DataSource to the business object, and make that the ReportDocument property of an InstanceReportSource. After returning that to the front-end, I am stuck.

How can I get that InstanceReportSource in the report viewer? Am I going about this in the wrong way to begin with?

3 Answers, 1 is accepted

Sort by
0
Milko
Telerik team
answered on 25 Aug 2017, 11:19 AM
Hello, Justin,

Thank you for questions, but I am not quite sure I understood your scenario completely. If you are trying to run an MVC application I would suggest taking a look at the examples we provide within the installation (folder  <installation folder>\Telerik\Reporting R2 2017\Examples\CSharp - project CSharp.MvcDemo).
Also, you could take a look at ObjectDataSource which could help you integrate your custom business object into Telerik Reporting and if I understood correctly you would like to have some Custome Report Resolver.

For the Angular part of your application, I would suggest taking a look at Example (<installation folder>\Telerik\Reporting R2 2017\Examples\Angular) once again and try to connect with the MVC project from the Examples. One common issue that is a stopper for integration Angular application with Telerik Reporting Rest service is CORS. You need to enable CORS for the Reporting REST service - How to Enable CORS for the Reporting REST service (in the service's project).

I hope some of the guidance and links will help you, if not I would really appreciate more details about your custom scenario. Please take your time to examine the examples from the installation folder. I am waiting for your feedback.

Regards,
Milko
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
0
Justin
Top achievements
Rank 1
answered on 28 Aug 2017, 02:34 PM

Hi Milko,

Thanks for the response. I was looking in to enabling CORS like you suggested. If I am able to test the REST service by appending  "api/reports/formats" to my url like in the Reporting REST Service documentation, and get back the JSON with the reporting formats, would enabling CORS be the problem?

Also, regarding the Custom Report Resolver, is there an example available of using a custom resolver with an InstanceReportSource? Right now, my ReportingService class looks something like this: 

namespace SampleReportApp.Services.ReportServices
{
    public class ReportingService
    {
        public static InstanceReportSource GetPeakUsage()
        {
            //Query Database
            ProcessedPeaksList searchResults = new ProcessedPeaksList(); //In actual project, this line returns a ProcesedPeaksList (my business object containing the query results)
            PeakUsageReport peakUsageReport = new PeakUsageReport();
            peakUsageReport.DataSource = searchResults.processedPeaks;
 
            InstanceReportSource IRS = new InstanceReportSource();
            IRS.ReportDocument = peakUsageReport;
 
            return IRS;
        }
    }
}

 

I am unclear on how to display the report in the ReportViewer. Do I have to have the Custom Resolver create an XML definition in my database beforehand, or is there another way to resolve the reports?

0
Nasko
Telerik team
answered on 29 Aug 2017, 01:18 PM
Hello Justin,

We replied to your question in your support ticket. Let us continue the discussion there to keep all the information in a single thread, so it is easier for us to investigate.

Regards,
Nasko
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
Justin
Top achievements
Rank 1
Answers by
Milko
Telerik team
Justin
Top achievements
Rank 1
Nasko
Telerik team
Share this question
or