BackPrevious Page Next PageNext

Customizing the Crosstab Layout

When you create or edit a crosstab, you can use the Layout screen of the crosstab wizard to customize the layout of the crosstab according to specific data displayed in the crosstab so as to make the data more intuitive and readable.

Crosstab Wizard - Layout screen

The following are properties that are provided in the Layout screen.

Aggregate

Specifies properties of the aggregate fields.

Suppress Row Grand Totals

Specifies whether or not to show the grand totals of row groups. If required, you can click Choose button to open the Suppress Row Grand Totals dialog to specify which grand totals of the row groups will be suppressed and which will be shown.

Suppress Column Grand Totals

Specifies whether or not to show the grand totals of column groups. If required, you can click Choose button to open the Suppress Column Grand Totals dialog to specify which grand totals of the column groups will be suppressed and which will be shown.

Suppress Row Subtotal

Specifies whether or not to show the subtotals of rows. If required, you can click Choose button to open the Suppress Row Subtotal dialog to specify which subtotals of the rows will be suppressed and which will be shown.

Suppress Column Subtotal

Specifies whether or not to show the subtotals of columns. If required, you can click Choose button to open the Suppress Column Subtotal dialog to specify which subtotals of the columns will be suppressed and which will be shown.

Repeat Column Header

Specifies whether or not the header of columns will appear on every page, if a crosstab spans more than one page.

Use Table Style

Specifies whether to add headers to the Total rows and columns.

Column Totals On

Specifies the position of total columns on the left or right of the aggregates.

Row Totals On

Specifies the position of total rows on the top or bottom of the aggregates.

Besides using the wizard, you can also customize the layout of a crosstab in a page report, web report or library component by setting properties in the Report Inspector.

Example of customizing the crosstab layout

Suppose you want to have a crosstab to show the total cost, quantity and sales of different product categories and types for different customers in China and Germany, you can create it as follows:

  1. Open the catalog file SampleReports.cat in <install_root>\Demo\Reports\SampleReports.
  2. Create a web report.
  3. Insert a crosstab in the web report as follows: use WorldWideSalesBV in Data Source 1, show Product Type and Category in the Products table on the columns, Country and Customer Name in the Customers table on the rows, Total Quantity, Total Cost and Total Sales as the aggregate fields, specify the field names as the display names to label the rows, columns and summaries, and add a filter condition @Country = China Or @Country = Germany.

    Create Crosstab wizard - Display screen

  4. Save the report and click View > Preview As > Web Report Result to preview the report and it appears as follows:

    Preview crosstab as Web Report Result

  5. Close the report and return to the Design tab in JReport Designer.
  6. Right-click the crosstab and select Crosstab Wizard from the shortcut menu.
  7. In the Crosstab Wizard, click Layout to switch to the screen.
  8. Check Repeat Aggregate to show the aggregate field values for each customer in their own cells.
  9. Check Horizontal Layout to arrange the aggregate fields horizontally and specify the option Number of Columns to 2.
  10. Select left from the Column Totals On drop-down list and top from the Row Totals On drop-down list.

    It is better to uncheck Outside Aggregate Title, as the labels of the aggregate fields would be far from their values. It is also suggested that you uncheck Use Table Style, otherwise the row and column headers will be repeated too much. As for suppress related properties, you can specify them as required. You can decide which part of the aggregate field values to see. Here, we keep the default settings of these properties.

  11. Save the report and preview it again. The crosstab now appears as follows:

    Preview crosstab as Web Report Result

BackPrevious Page Next PageNext