Skip to Content

I love getting interesting questions thrown my way, it gives me the opportunity to not only learn something new, but also find out what Crystal Reports users are trying to do, and just how functional Crystal Reports is.

The question that crossed my path a couple of times is one that has been showing up in our forums, how to build reports off of the Entity Data Model (EDM) Framework.

Not having any idea what this was or why one would want to use it I did some searching and came across this web site that had a great introduction to this

I followed this just to the point where I could display the Northwind Customers table in a datagrid. Then I went and tried to create a report off of the EDM Customers table, and it was amazingly easy to do.

I am going to assume when you are reading this you already have your EDM already created, if you haven’t and don’t know where to begin, I suggest the link above.

To report off of this is two steps, first you have to create the report:

  1. Right-Click your project and select Add New Item.
  2. Under Reporting select Crystal Report and click Add.
  3. Click OK to use the Report Wizard.
  4. Expand Project Data
  5. Expand .NET Objects
  6. You should now see a list of your available tables in your EDM
  7. Select a table and add it, in my case I selected Customers
  8. Click Next and continue to go through the wizard.

The second thing you need to do is set datasource at runtime. This is simple as creating an instance of your EDM in code, and calling the report’s SetDataSource method like this:



// Create an instance of the Customers table
            EntityModel.Customers emCustomers = new Customers();

            // Create and instatiate strongly-typed report
            CrystalReport1 MyCrystalReport1 = new CrystalReport1();

            // Set the report’s datasource to my EDM and then view
crystalReportViewer1.ReportSource = cr;


As you can see this is fairly simple to do.

Happy Reporting!

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Bob Doran
    After some research I have found that using entity data model objects for a report data source works fine except that nullable fields are not available for use on the report.  We have many instances in our database where records contain some null fields which are filled in over time.  Not being able to include these fields on a report is not acceptable.  It is worth noting that when DataSets are used rather entity data model objects these SAME nullable fields may be placed on the report.  This is no doubt due to the different implementations of the underlying entity data model and DataSet designer files.  After much searching I have been unable to find any workable solutions; none of them address the problem of not being able to use the nullable fields in the CR designer within Visual Studio.  Does SAP have any work-arounds?  Thanks

Leave a Reply