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.
Reports - Support creating reports for a non-persistent type via CollectionDataSource
Answers approved by DevExpress Support
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.
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:
- 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; }
}
- 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).
- 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.
- v15.1.4Download Official Update