Cross-Tab Report
This tutorial describes the steps needed to create a cross-tab report using the Pivot Grid control. This feature should not be confused with the master-detail report or table report. Additionally, the document demonstrates how to visualize data displayed in the Pivot Grid by linking it with the Chart control.
Create a Cross-Tab Report
To create a cross-tab report, do the following.
- Create a new empty report.
Drop the Pivot Grid control from the Toolbox onto the report's Detail band.
To bind the Pivot Grid to a data source, right-click it and select Edit... in the context menu. In the invoked dialog, expand the Data Source drop-down and click the Add New button.
The invoked Data Source Wizard will guide you through the process of assigning a data source to the grid. For detailed instructions on the Wizard's steps, refer to Binding a Report to Data, as this process is similar.
After the data source is created, it is assigned to the pivot grid's Data Source property. Its Data Member property defines from which table or view of the data source the grid obtains its data.
Note
Since you have placed a Pivot Grid in the Detail band, the report's Data Source property should not be set. Otherwise, the Pivot Grid will be repeated at the preview as many times as there are records in the data source.
Once again, right-click the Pivot Grid and select Run Designer... in the invoked context menu.
In the invoked PivotGrid Designer, click Retrieve Fields.
Then, switch to the Layout section in the navigation bar on the left.
Drag and drop the required fields to the Row Fields, Column Fields and Data Items areas.
Click Apply and close the editor.
In the last step, you can set your report's Vertical Content Splitting option to Smart. This will split the grid's columns precisely by their borders in the Print Preview.
The cross-tab report is now ready. Switch to the Print Preview tab and view the result.
Integrate with a Chart Control
The next step is to visualize data displayed in the Pivot Grid using a Chart control. To accomplish this, perform the following steps.
- Drop the Chart control from the Toolbox onto the report's Detail band below the Pivot Grid. After you drop the Chart, the Chart Designer is automatically invoked.
In the Designer, remove an already existing series by clicking the corresponding button.
Then, go to the Data tab at the right of the Designer's window and choose the Pivot Grid in the dedicated drop-down list.
After this, all the Chart's binding and layout settings are automatically adjusted. Make sure that Series, Argument and Value cells have been automatically filled with the corresponding fields. Note, values for these fields are generated based on the Pivot Grid's columns, rows and data items, respectively.
To avoid the overlapping of series labels, select the auto-generated series in the chart elements tree, and in the Options tab, disable the Labels Visibility check box.
- If required, you can customize various settings that determine the common behavior for a bridged Chart and Pivot Grid pair. To do this, use the Chart's Pivot Grid Data Source Options property. This property, in turn, is linked to the Options Chart Data Source property of the associated Pivot Grid.
Finally, reset the report's Vertical Content Splitting option and switch to the Preview Tab to see the result.