Ticket T520999
Visible to All Users

xtrareport Entity Framework Filter

created 8 years ago

Hi,

I connect an xtrareport datasource to an objectcontext objectset.
All work find for the designer and to retrieve data but when I add filter, the xtrareport don't add the filter and load all data row in the database.

I trie to change the datasource by an DevExpress.DataAccess.EntityFramework.EFDataSource but it never apply filter on the requested query.

Is there a way to filter at datasource level and not at xtrareport level?

Thanks in advance

Answers approved by DevExpress Support

created 8 years ago

Hello Stephane,

Let me provide you with the information my colleague posted in the EFDataSource with Large Database and DataSource level filtering private ticket, where he discussed a similar behavior:

Thank you for your question. At present, the EFDataSource component doesn't support server-side filtering. That's something we look forward to as the XtraReport.FilterString expression always operates with the already loaded in-memory collection of objects, but right now, there are no time estimates. One of the possible workarounds here is to implement a stored procedure that would accept the required value as a parameter (it will be available only if defined in your EDMX model —  code-based modeling is not supported).  And if you don't have any stored procedures to bind to, here is an alternative solution: use the object binding approach. That is, use the ObjectDataSource component to expose the schema of the target class at design time (How to: Bind a Report to an Object Data Source). In this case, actual data should come from the XtraReport.DataSourceDemanded event (or its scripting counterpart) — this is where you're supposed to execute your LINQ query that will fetch data based on the actual report parameter values and assign the resulting IList collection to the report's data source. Just to be clear: the ObjectDataSource is not about the Entity Framework or any other ORM, it doesn't have any idea of what the DBContext is. Essentially, it's just a way to bind a report to an arbitrary class at design-time and expose its schema: How to: Bind a Report to a List Object at Design Time and Provide Data at Runtime.

In addition, take a look at the latest comment posted in the Report filter child report based on parent property thread.

Thanks,
Dmitry

    Comments (2)
    SC SC
    Stephane Crepet 8 years ago

      Hi,

      I found a way to launch the filter with a linq command.
      But when I open the xtrareport designer with an objectdatasource assigned in code to the report, it load all data and not only the schemas.
      My ObjectDataSource is parametered with an ObjectContext as the datasource and an EntityName as the DataMember

      Is there a parameter to force the designer to load only the schemas?

      Thanks in advance

      Dmitry Tokmachev (DevExpress) 8 years ago

        Hello Stephane,

        While there is no such parameter that manages this behavior, it would be great if you share the technical details with me: the definition of the ObjectDataSource component and the way you are providing a report with data / displaying it in the End-User Report Designer. The shortest route to a solution would be if you provide me with a complete sample demonstrating your implementation or describe how to reproduce a similar behavior using any test database.

        I look forward to hearing from you.

        Thanks,
        Dmitry

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.