Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • I'm trying to hook up the report to an Oracle database via the Entities framework. I understand in order for my report to see data during design preview I must add code to the BeforePrint script. My project is setup with an MVC app to display the report, a Reports class library to hold the reports, and a ReportData class library to retrieve the data. In the Script References I've entered the following:

                                    System.Data.Entity.dll
                                    System.Core.dll
                                    ReportData.dll
                                    Reports

                                    In the scripts I've entered the following:

                                    using System.Linq;
                                    using ReportData;
                                    using Reports;

                                    private ReportData.ReportHeaderEntities _reportHeaderEntities = new ReportData.ReportHeaderEntities();
                                    private ReportData.SiteListEntities _siteListEntities = new ReportData.SiteListEntities();

                                    private void SiteListReport_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
                                         this.bindingSourceSiteList.DataSource = _siteListEntities.SDS_SITE_LIST_RPTV;
                                         this.bindingSourceHeader.DataSource = _reportHeaderEntities.SDS_REPORT_HEADERS_RPTV;
                                    }

                                    private void SiteListReport_AfterPrint(object sender, System.EventArgs e) {
                                         _reportHeaderEntities.Dispose();
                                         _siteListEntities.Dispose();
                                    }

                                    in the Scripts Errors window I get the following error:

                                    The type 'System.Entity.DbContext' is defined in an assembly that is not refrenced. You must add a reference to assembly 'EntityFramework...

                                    I have a reference to System.Data.Entity in each of my assemblies. I don't know why I'm getting this error. I've been struggling for days trying to get a simple report to display data in an MVC app both at designtime and runtime. This seems like it should be automatic and I shouldn't have to struggle like this. Any help would be greatly appreciated!

                                0

                                Hello Darrell:
                                   Have you tried running this code outside of the context of scripting? My suggestion would be to remove the scripts and then handle the report's BeforePrint and AfterPrint events within the actual class and see what happens at runtime. If this works then it is often a problem with Script references. Here is a useful
                                document that should help you get started.

                                -Seth

                                0

                                I found that adding a reference to the System.Data.Entity framework is not enough. I needed to add a referernce to EntityFramework itself. Now that error has gone away but has been replace by two more errors. Here is my script code now:

                                private ReportData.ReportHeaderEntities _reportHeaderEntities = new ReportData.ReportHeaderEntities();
                                private ReportData.SiteListEntities _siteListEntities = new ReportData.SiteListEntities();

                                private void SiteListReport_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
                                     this.bindingSourceSiteList.DataSource = _siteListEntities.SDS_SITE_LIST_RPTV;
                                     this.bindingSourceHeader.DataSource = _reportHeaderEntities.SDS_REPORT_HEADERS_RPTV;
                                }

                                private void SiteListReport_AfterPrint(object sender, System.EventArgs e) {
                                     _reportHeaderEntities.Dispose();
                                     _siteListEntities.Dispose();
                                }

                                In the BeforePrint event I'm trying to assign the data to the binding sources on the report but I'm getting errors saying 'ScriptingNamespace.ScriptingReport' does not contain a definition for 'bindingSourceSiteList' and no extension method 'bindingSourceSiteList' accepting a first argument of type 'ScriptingNamespace.ScriptingReport' cound be found. I get the same error for the other binding source. Please, how do I get this to work so I can preview the data at runtime? I can't assign the data to the report directly because there are two binding sources on the report. I need to assign the data to each binding source unless I'm doing this completely wrong. This seems like it should be so simple, create a report then click Preview and see what it looks like. Why is this so difficult?

                                0

                                Darrell:
                                   Thanks for the update. Is there a reason you chose to use scripting? Would supplying this code to the report class be sufficient? (My sense is that there is a missing reference with the scripting engine).

                                -Seth

                                0

                                We're testing your reporting services to replace our current SSRS. In SSRS and other reporting systems there's a preview button to allow you to view the report with actual data. XtraReports has a preview button as well but it does nothing. You sent my fellow developer a sample application that is structured just like the sample app I'm building. Your sample app is built on a simple object collection and the design preview does not work in it either. It's critical for us that the report be able to preview what it will look like with actual data in design mode without having to run the main application. I've been working on this for over a week now and am getting quite frustrated! In other posts I've read on your website the answer seems to be to write scripts in the BeforePrint event of the report to load the data for preview. That doesn't make a lot of sense to me but that's what I've read in a number of places. If there's another way I'd appreciate knowing about it. This seems like such a basic requirement yet there's no real information on it anywhere that I can find. Like I said, I've been working on what should be a very simple process for over a week now with no success. There simply must be a straight forward approach to this since there's a preview tab that does nothing at this point. Please help me out and explain to me how I can connect a report to ANY data source be it the entity framework or a collecton of objects and preview the report in design mode without having to run the application. Thank you!

                                0

                                By the way, you never answered my question as to why I can't refer to a binding source that is part of the report. Let me make sure I'm clear about this. As in the sample application you sent us I've added two binding sources, one for the header data and one for the report data. One is named bindingSourceHeader and the other is named bindingSourceSiteList. I've never been fond of data binding and have not found a way to combine the two tables into a single binding source thus the two binding sources on the report. Many of our reports require binding to multiple table, Oracle views actually. In the ScriptReferences property of the report I have the following references:

                                System.Data.Entity.dll
                                EntityFramework.dll
                                System.Core.dll
                                ReportData.dll
                                Reports

                                The second one, EntityFramework.dll, was added to resolve the previous problem. The last one is a reference to the current assembly which I also saw in another post on your site. Below are the scripts:

                                private ReportData.ReportHeaderEntities _reportHeaderEntities = new ReportData.ReportHeaderEntities();
                                private ReportData.SiteListEntities _siteListEntities = new ReportData.SiteListEntities();

                                private void SiteListReport_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
                                     this.bindingSourceSiteList.DataSource = _siteListEntities.SDS_SITE_LIST_RPTV;
                                     this.bindingSourceHeader.DataSource = _reportHeaderEntities.SDS_REPORT_HEADERS_RPTV;
                                }

                                private void SiteListReport_AfterPrint(object sender, System.EventArgs e) {
                                     _reportHeaderEntities.Dispose();
                                     _siteListEntities.Dispose();
                                }

                                The problem here is I get a 'ScriptingNamespace.ScriptingReport' does not contain a definition for 'bindingSourceHeader'... I also get the same error for the bindingSourceSiteList. I tried to add a reference to System.Windows.Forms.dll to the ScriptReferences but that didn't help. If I don't have to jump thru these hoops to view the data in design preview mode great, tell me how to do it, however if I do have to do this, tell me why the report scripting engine doesn't understand the assembly it's a part of. Does that make sense? The bottom line is we MUST be able to view data in design preview mode regardless of data source. Please tell us how to achieve that in a concise, step-by-step fashion. Thank you!

                                0

                                Seth,

                                We're testing your reporting services to replace our current SSRS. In SSRS
                                and other reporting systems there's a preview button to allow you to view
                                the report with actual data. XtraReports has a preview button as well but it
                                does nothing. You sent my fellow developer a sample application that is
                                structured just like the sample app I'm building. Your sample app is built
                                on a simple object collection and the design preview does not work in it
                                either. It's critical for us that the report be able to preview what it will
                                look like with actual data in design mode without having to run the main
                                application. I've been working on this for over a week now and am getting
                                quite frustrated! In other posts I've read on your website the answer seems
                                to be to write scripts in the BeforePrint event of the report to load the
                                data for preview. That doesn't make a lot of sense to me but that's what
                                I've read in a number of places. If there's another way I'd appreciate
                                knowing about it. This seems like such a basic requirement yet there's no
                                real information on it anywhere that I can find. Like I said, I've been
                                working on what should be a very simple process for over a week now with no
                                success. There simply must be a straight forward approach to this since
                                there's a preview tab that does nothing at this point. Please help me out
                                and explain to me how I can connect a report to ANY data source be it the
                                entity framework or a collecton of objects and preview the report in design
                                mode without having to run the application. Thank you!

                                Regards,

                                Darrell Sparti

                                0

                                Seth,

                                By the way, you never answered my question as to why I can't refer to a
                                binding source that is part of the report. Let me make sure I'm clear about
                                this. As in the sample application you sent us I've added two binding
                                sources, one for the header data and one for the report data. One is named
                                bindingSourceHeader and the other is named bindingSourceSiteList. I've
                                never been fond of data binding and have not found a way to combine the two
                                tables into a single binding source thus the two binding sources on the
                                report. Many of our reports require binding to multiple table, Oracle views
                                actually. In the ScriptReferences property of the report I have the
                                following references:

                                System.Data.Entity.dll
                                EntityFramework.dll
                                System.Core.dll
                                ReportData.dll
                                Reports

                                The second one, EntityFramework.dll, was added to resolve the previous
                                problem. The last one is a reference to the current assembly which I also
                                saw in another post on your site. Below are the scripts:

                                private ReportData.ReportHeaderEntities _reportHeaderEntities = new
                                ReportData.ReportHeaderEntities();
                                private ReportData.SiteListEntities _siteListEntities = new
                                ReportData.SiteListEntities();

                                private void SiteListReport_BeforePrint(object sender,
                                System.Drawing.Printing.PrintEventArgs e) {
                                this.bindingSourceSiteList.DataSource =
                                _siteListEntities.SDS_SITE_LIST_RPTV;
                                this.bindingSourceHeader.DataSource =
                                _reportHeaderEntities.SDS_REPORT_HEADERS_RPTV;
                                }

                                private void SiteListReport_AfterPrint(object sender, System.EventArgs e) {
                                _reportHeaderEntities.Dispose();
                                _siteListEntities.Dispose();
                                }

                                The problem here is I get a 'ScriptingNamespace.ScriptingReport' does not
                                contain a definition for 'bindingSourceHeader'... I also get the same error
                                for the bindingSourceSiteList. I tried to add a reference to
                                System.Windows.Forms.dll to the ScriptReferences but that didn't help. If I
                                don't have to jump thru these hoops to view the data in design preview mode
                                great, tell me how to do it, however if I do have to do this, tell me why
                                the report scripting engine doesn't understand the assembly it's a part of.
                                Does that make sense? The bottom line is we MUST be able to view data in
                                design preview mode regardless of data source. Please tell us how to
                                achieve that in a concise, step-by-step fashion. Thank you!

                                Regards,

                                Darrell Sparti,

                                0

                                Darrell:
                                  Thanks for the update. I understand the problem and think there is a workaround. My question is why you chose to use scripting as a mechanism for doing the binding. It would be infinitely faster to use the approach I outlined in the sample.
                                To answer your second question, since you are binding to objects rather than tables and views a better (faster approach) if you are going directly to oracle is to use datasets with built in table adapters.
                                To answer directly, you probably need to add the System.Windows.Forms assembly since it is tied to a BindingSource (which belongs to that namespace). Hope this helps! I want this to work for you!

                                -Seth

                                0

                                Thanks for the response Seth.

                                The reason I did it that way is because in your sample it didn't work
                                either. You're binding to a simple collection of objects and when I click
                                on the preview tab in the designer, I get nothing. Therefore I've search
                                around your support area and each time (sorry I don't have time to find and
                                list a bunch of links right now) the suggestion is to use before print
                                script event. Trust me, I'm not one to reinvent the wheel I'm just trying
                                to get something to work.

                                I can't use Datasets because we're in a multi-tiered environment and our new
                                version will be using the Entity Framework however there will be a layer
                                between the report solution and the Entity Framework because we can't
                                connect directly to the database. This is an enterprise level company and
                                simple solutions are just not going to work. As a proof of concept I must
                                use Linq to Entities to retrieve my data. I also need to use Linq queries
                                to filter the data.

                                I did add the System.Windows.Forms.dll assembly reference into the script
                                references and it had no effect. I also read in one of your documents that
                                isn't necessary but I did it anyway without affect.

                                I'm currently trying to abstract the data layer further away by making a
                                data service assembly with interfaces and Linq classes to retrieve the data
                                however I still don't know how to get this to work when previewing the
                                report in the designer. If you want to get a better idea of exactly what it
                                is I'm doing refer to your video:
                                http://tv.devexpress.com/#WinFormsReports-ReusableReports;XtraReports+Suite.product;1
                                The only problem is that video never shows you what the report looks like in
                                the designer preview or how to make that work and that's exactly what I
                                need.

                                Regards,

                                Darrell Sparti, MCSD

                                0

                                Seth, I got the report running though I still don't have design preview
                                capability. But now I notice that the toolbar functionality has stopped.
                                Any clue why the toolbar buttons don't to anything?

                                Regards,

                                Darrell Sparti, MCSD

                                0

                                Seth, I'm running out of time to review your product. As it stands right now I can get a report to display but none of the toolbar buttons work! I still can't figure out how to get a report to display in design preview! Other developers have tried to test and there seems to be issues with versioning. I'm concerned that if we move forward with this as updates come out our reports will break. As I said we're running out of time if we can't get these basic reporting issues solved I'm afraid we're going to have to seek other options.

                                0

                                Thinking perhaps a reference was missing or something got messed up, I recreated the project from scratch to see if I could get the MVC toolbar working but still no luck! Note that when I created the MVC project I chose the DevExpress ASP.NET MVC 3 Web Application v11.2 (Razor) which added all of the references and script requirements. This is a show stopper for us! We really need some help here and we're running out of time.

                                0

                                Seth I got the report toolbar working, my bad. Something put a 1 after the name of the report so an invalid report name was being passed to it. Now if we can just get the design time view working we'll be there!

                                0

                                Darrell:
                                   There is also an option of creating an end user report designer that will have the preview working as well. Here are a couple of videos that should help:
                                1. The End User Report Designer
                                2. Custom Report Storage
                                The reason the preview does not work straight away when binding to objects is because there is not notion of data acquisition built directly into the objects to which you are binding. This is by design as it allows the greatest flexibility when creating and consuming reports.
                                We do, however, allow the ability to create a custom end user report designer where these things can be put together in a manner consistent with your particular stack. I hope this helps!
                                I want this to work for you!

                                -Seth

                                0

                                Unfortunately this does not answer my question.

                                0

                                Darrell:
                                  Thanks for the feedback. To be clear, which feature is not working properly? Perhaps it would be best if I made a sample application.

                                -Seth

                                0

                                Seth, thanks for everything! I've been working with Alex and he's opened some doors for me. I've solved a number of issues including one your site said couldn't be done, assigning a CSS file to a report. I'm going to be working on this for the next couple of days and when I'm done, if I've broken some new ground, I'll post my finding to make it easier for you and other developers to solve problems they too might be having. I'm confident at this point that my company will go with your product so we'll be in touch again soon. You can close this issue if you'd like.

                                0

                                Thanks again Seth and Alex!!

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners