Ticket T250421
Visible to All Users

Reports - Support creating reports for a non-persistent type via CollectionDataSource

created 10 years ago (modified 10 years ago)

Currently, non-persistent types are not available on the drop-down list when creating a report, and there is no unified way to feed a report with a collection of non-persistent objects.

Answers approved by DevExpress Support

created 10 years ago (modified 8 years ago)

We have implemented the functionality described in this ticket. It will be included in our next update(s).

Please check back and leave a comment to this response to let us know whether or not this solution addresses your concerns.

Additional information:

Starting with version 15.1.4, you can create reports based on non-persistent data, which is not generally queried from a database or without using your ORM data models. For instance, this can be helpful for analysis and reporting data obtained from dynamic runtime calculations, stored procedures (SP), arbitrary SQL queries or third-party services. To be able to use our reporting module and its features you will need to define your data structure with the help of a non-persistent POCO and then create required object instances on an event.

To test this new feature, consider the following implementation steps:

  1. Create a non-persistent class decorated with the DomainComponent  and VisibleInReports/DefaultClassOptionsattributes (the latter option can also be set at the BOModel | Class level in the Model Editor):
C#
[DevExpress.ExpressApp.DC.DomainComponent, DevExpress.Persistent.Base.VisibleInReports] public class NonPersistentClass { public NonPersistentClass(string name) { Name = name; } public string Name { get; set; } public int Number { get; set; } }
  1. Register the NonPersistentObjectSpaceProvider, subscribe to the XafApplication.ObjectSpaceCreated and NonPersistentObjectSpace.ObjectsGetting events as per Core - Provide an easy way to show a list of non-persistent objects created at runtime (the latter part can be done from a Controller like the one in the attachment).
  2. Create a new report and add the CollectionDataSource component targeting your non-persistent type. Depending on whether you configure the report using the runtime wizard or report designer, you can choose the NonPersistentClass from the corresponding drop down editor:

Report wizard:

Report designer:

4. Preview your report based on the non-persistent data you supplied in the ObjectsGetting event:


Take special note that ViewDataSource is not supposed to work with non-persistent data.
You will need to additionally check out our reporting documentation at  eXpressApp Framework > Concepts > Extra Modules > Reports V2 Module to be able to complete this step.

    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.