Users can produce an order report by selecting an option from the Report menu on the action bar. The Print icon in the top left corner will activate the first option in the Report menu.
However, the default report only displays a top-down list of fields and values of the selected order. Order details are not present.
Let’s implement an action on the order form that will produce a report using a custom report template. This template will render the data in the same layout as the order form, and include all relevant order details.
Such a report requires a denormalized data set joining rows from Orders, Order Details, Employees, and Shippers tables.
A denormalized data set can be created using one of the following methods:
- Using the Denormalization Field Map to extend the field set available in OrderDetails controller.
- Creating a data controller based on a database view that joins all required tables.
The data controller needs to be extended with a view that includes all data fields required for the report. A custom report template must be enabled for the view. The generated template can be customized directly in Visual Studio.
Finally, an action is needed to activate the report. Action parameters will map the current OrderID as a filter for the report data controller.