The requested page is not available for the requested platform. You are viewing the content for Default platform.
A newer version of this page is available. Switch to the current version.

Show Reports for Individual Views

  • 3 min to read

The Reports module allows you to design reports for a filtered data source (see Filter Report Data Source using XtraReports Parameters and Filter Report Data Source using the ParametersObjectType Property). In some scenarios, you may need to preview a report for a certain object or a set of objects that are not related by criteria. For example, the Invoice business object(s) should be able to be printed in a specific manner. In this case, a specially designed report should be available for display for a particular set of Invoice objects. For this purpose, use the Inplace Reporting feature provided by the Reports module. This topic demonstrates how to use this feature. You can also see this feature in the Reports section of the FeatureCenter Demo, which is supplied with XAF. This demo is located in the %PUBLIC%\Documents\DevExpress Demos 18.2\Components\eXpressApp Framework\FeatureCenter folder, by default.

To show selected object(s) in a specified report, the Reports module introduces the ShowInReport Action. This Action represents the SingleChoiceAction class instance. Its items represent so-called inplace reports that are designed for the current View's object type.

InplaceReports

InplaceReports_Web

When executing this Action, the selected report is shown in the Preview window. The report presents the object(s) selected in the current Detail View or List View.

InplaceReports_Preview

InplaceReports_Preview_Web

The ShowInReport Action is contained in PrintSelectionBaseController. This Controller collects the inplace reports that are appropriate for the current object type and creates corresponding items for the Action. When there are no appropriate inplace reports for the current object type, the ShowInReport Action is not activated. Inherit from this controller or use its events when implementing a custom functionality. This Controller has no platform-specific descendants.

Inplace reports represent common reports that can be created in an XAF application. However, their ReportData.IsInplaceReport property is set to true. By default, this property is set to false. To specify this property, invoke a Detail View for the required report. To do this, use the EditReportController.Edit Action in the WinForms application:

InplaceReports_EditAction

In ASP.NET applications, you cannot invoke a Detail View for a report because of the Reports architecture. It is presumed that end-users can design and edit reports in WinForms applications only. In ASP.NET applications, they can only view and save them.

Note
  • All filters specified for a report's data source are ignored when the report is previewed as an inplace report via the ShowInReport Action. This behavior is caused by the fact that inplace reports are intended to print selected objects only.
  • The ShowInReport Action is disabled if there are unsaved changes. You need to commit changes to preview a report.

The Application Model's IModelNavigationItemsForReports.GenerateRelatedReportsGroup property specifies whether or not context navigation is enabled for the Reports module. When this property is set to true, the Report module adds navigation items for the items corresponding to business classes participating in existing inplace reports. Each added item represents an inplace report. For additional information on context navigation, refer to the Navigation System help topic.

You can disable the Inplace Reports feature. To do this, use one of the following techniques:

  • In the Application Designer

    Select the Reports module in the Modules section, and set the EnableInplaceReports property to false in the Properties window.

  • In code

    Before an XafApplication object is created, set the static ReportsModule.DefaultEnableInplaceReports property to false.