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

Using Entities (or POCO) With Telerik Reporting

2 Answers 223 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mike Gardner
Top achievements
Rank 1
Mike Gardner asked on 11 Dec 2009, 04:31 PM
I'm working on developing a best practices for reporting in our application.

Currently we're looking at SSRS (SQL Server Reporting Services) and Telerik (we use the client controls).

After looking at the documentation and installing the reporting tools I've come up against a wall at getting some basic data to display in a report.

Generally our app deals exclusively with entity objects.  On many pages we have a RadGrid in which we use the NeedDatasource event to call a static method on the type of the entity that the grid will display.  In this method we create a LINQ query and get back an IQueryable of entity objects which is then passed back to the datasource of the grid.  The dataset is set to the enumeration of the IQueryable.  We would like to continue doing this flow with reporting.

Our app currently moves the user through several wizard like screens of gathering information regarding what the report data will entail.  Once this data is collected a stored procedure is called that then gathers these "parameters" and does the calculations to produce a result set.  This result set basically contains some aggregate data that is brought together from various places in the database and worked into a meaningful order via the business logic in the stored procedure in regards to the user's inputs.

Even once this "report data" is created another query may be necessary to bring in some meaningful data from the inputed parameters.  This is really necessary when displaying in SSRS from the Reporting Server as each row in this query would be a displayable item in the report (the grouping of the report may change the query slightly but that is more a consideration once I have a complete understanding of how the report is to be designed).

So, the point is that this stored procedure generates the data for a single report and stores it in a table that contains this data for previously run reports.  My ideal situation would be to have the web page (or in our next version Silverlight control) call a method on the static type of the entity that represents this table of results that would return back the cached results for the report and pass this along to the telerik report.

This seams simple in theory.  I would just set the datasource for the report to be the results of this method call.  Am I correct in this assumption?

It should be noted that this is all fine and dandy if I can get to the point of actually "running" the report (I say running because the stored procedure actually creates the data and stores it in a table; in my simplest idea of how this would work the actually telerik report would "run" when it got the results of this query from a table - this report may be "run" multiple times but the stored procedure would only be run when the user wanted get the most up-to-date info).  Right now I cannot get the report designer to allow me to design a report with an object.

How do I do this???  I have created a report project and added it to my solution.  In this project I have included a reference to the assembly that deals exclusively with creating these entity objects and handing them off to consumers.  In the wizard I have followed the steps to use an object as a data source yet there are no auto-generated columns shown for the report nor are they appearing under the "Data Explorer".  The "Data Explorer" shows "No Data Source".

This leaves me wondering how to design a report when I cannot see the datasource in the designer.  I assume it would be possible for me to hand code each expression.  This seems tedious and time consuming.

The biggest advantages for us using Telerik's reporting is that we can embed the report in Silverlight and that we supposivly use Entity Framework business objects (or POCO - plain old class object) as a data source.  It just seems to me that it is possible, but just difficult or not a "best practice".

Please provide some ideas where I might be making bad assumptions, have incorrect ideas of what is possible, or some solutions to make our desired workflow possible.

Thanks,

Michael Gardner

2 Answers, 1 is accepted

Sort by
0
Mike Gardner
Top achievements
Rank 1
answered on 11 Dec 2009, 04:56 PM
I see there might be a problem with the build that we have at the moment.  I'm upgrading to 2009.3.1211.  Hopefully that will get me to the point where I can design a report with a business object as its data source.  The other questions are still standing.

Thanks,
Michael Gardner
0
Steve
Telerik team
answered on 17 Dec 2009, 12:07 PM
Hi Mike Gardner,

"I would just set the datasource for the report to be the results of this method call.  Am I correct in this assumption? "

Yes, setting the datasource of the processing report object to your method that returns the data would be sufficient.

"In the wizard I have followed the steps to use an object as a data source yet there are no auto-generated columns."

Please note that both the Report Wizard and DataSource wizard would only show the properties of your class - no methods and functions are shown and this is by design. If you want to bind to a method that returns the datasource, then you should use the NeedDataSource event as you have figured out in #1.

You can review the following help links that should get you started:


Best wishes,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Mike Gardner
Top achievements
Rank 1
Answers by
Mike Gardner
Top achievements
Rank 1
Steve
Telerik team
Share this question
or