Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • This question is related to Q236953 where logically after filtering the object class, user who uses the report can view data according to the controller filtered criteria.

                                    It was mention here on ID Q207250 (Data level security)
                                    >>There is no possibility to apply this filter to DetailViews, as well as to Reports and Analysis modules, because these modules don't create controllers at all.

                                    is there a workaround for this?

                                1 Solution

                                Creation Date Rating Importance Sort by
                                0

                                Hello Dave,

                                We've discussed this task with one of our customers in an private issue, and there are two solutions for this problem:
                                1. I do not recommend that you allow end-users to work with the Report Designer. Please review the Action based Permission issue to learn how to disable the Show Report Designer action for certain users. In this case, you can use an approach demonstrated in the How to allow users to create filter via the criteria editor before previewing a report example to allow users to set custom criteria for reported data, and use the following code to filter the report by its owner:

                                [C#]
                                public class ViewController1 : ViewController { public ViewController1() { } protected override void OnActivated() { base.OnActivated(); Frame.GetController<WinReportServiceController>().CustomShowPreview += new EventHandler<CustomShowPreviewEventArgs>(ViewController1_CustomShowPreview); } void ViewController1_CustomShowPreview(object sender, CustomShowPreviewEventArgs e) { e.Report.FilterString = CriteriaOperator.Parse("Owner.Oid=?", SecuritySystem.CurrentUserId).ToString(); } protected override void OnDeactivating() { base.OnDeactivating(); Frame.GetController<WinReportServiceController>().CustomShowPreview -= new EventHandler<CustomShowPreviewEventArgs>(ViewController1_CustomShowPreview); } }
                                2. Otherwise, the simplest way is to set the required filter via the XtraReport.FilterString property, and hide this property from the Properties grid, as shown in the following code:
                                [C#]
                                public class ViewController1 : ViewController { public ViewController1() { } protected override void OnActivated() { base.OnActivated(); XtraReport.FilterControlProperties += new FilterControlPropertiesEventHandler(XtraReport_FilterControlProperties); Frame.GetController<WinReportServiceController>().CustomShowPreview += new EventHandler<CustomShowPreviewEventArgs>(ViewController1_CustomShowPreview); Frame.GetController<WinReportServiceController>().CustomShowDesignForm += new EventHandler<CustomShowDesignFormEventArgs>(ViewController1_CustomShowDesignForm); } void XtraReport_FilterControlProperties(object sender, FilterControlPropertiesEventArgs e) { if (e.Control is XtraReport) { e.Properties.Remove("FilterString"); } } void ViewController1_CustomShowDesignForm(object sender, CustomShowDesignFormEventArgs e) { e.Report.FilterString = CriteriaOperator.Parse("Owner.Oid=?", SecuritySystem.CurrentUserId).ToString(); } void ViewController1_CustomShowPreview(object sender, CustomShowPreviewEventArgs e) { e.Report.FilterString = CriteriaOperator.Parse("Owner.Oid=?", SecuritySystem.CurrentUserId).ToString(); } protected override void OnDeactivating() { base.OnDeactivating(); Frame.GetController<WinReportServiceController>().CustomShowPreview -= new EventHandler<CustomShowPreviewEventArgs>(ViewController1_CustomShowPreview); Frame.GetController<WinReportServiceController>().CustomShowDesignForm -= new EventHandler<CustomShowDesignFormEventArgs>(ViewController1_CustomShowDesignForm); } }
                                In this case end-users will be able to filter the report via the Filtering object.
                                Does any of these solutions meet your requirements?

                                Thanks,
                                Anatol

                                • Marco Castro 09.05.2013

                                  Anatol,

                                  Some code has changed, could you help me?

                                  this code: Frame.GetController<WinReportServiceController>()

                                  Error     88     The type 'DevExpress.ExpressApp.Reports.Win.WinReportServiceController' cannot be used as type parameter 'ControllerType' in the generic type or method 'DevExpress.ExpressApp.Frame.GetController<ControllerType>()'. There is no implicit reference conversion from 'DevExpress.ExpressApp.Reports.Win.WinReportServiceController' to 'DevExpress.ExpressApp.Controller'.     

                                • The WinReportServiceController class should be convertible to Controller, and it should be possible to pass it to the Frame.GetController method. It is unclear why this functionality does not work in your project. Please ensure that the class name passed to the GetController method references a class from our assembly, and a class with the same name and namespace is not defined in your project. If this does not help, please provide a sample project reproducing the problem.

                                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, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

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