BackPrevious Page Next PageNext

Inserting Crosstabs in a Report

Creating a crosstab based on a business view

Creating a crosstab based on a query resource

Example of creating a compound crosstab

With the crosstab wizard, it is easy to create crosstabs in a report, however the wizard varies with the data resource type used for the crosstab: business view or query resource.

A web report and library component can only use business views. For a page report it can be created either based on query resources or business views, which is determined at the time when the page report is created by the Create Using Business View option. Once defined, all the data components in the page report can only be created on the specified data resource type.

A crosstab can be inserted in the report areas listed in Component placement. When it is inserted into a banded object, you can use a data container link to define the relationship between the crosstab and its parent.

Creating a crosstab based on a business view

  1. Position the mouse pointer at the destination where you want to insert the crosstab.
  2. Do one of the following:

    The Create Crosstab wizard appears, which contains a set of screens for helping you define a crosstab easily. You can use the Back and Next buttons or click the screen name on the screen navigation bar to switch between the screens.

  3. In the Data screen, select the business view in the current catalog using which to create the crosstab. When the crosstab is to be inserted into the banded header, banded footer, group header, group footer panel of a banded object in a web report, you can also check Inherit from the Parent to inherit data from the business view used by the parent banded object.

    Create Crosstab - Data

  4. In the Display screen, specify a title for the crosstab in the Title text box if needed and specify the fields to display in the crosstab.

    Create Crosstab - Display

    The Resources box lists the view elements in the specified business view and the dynamic formulas and aggregations created for the business view in the current report. You can use these objects to create the crosstab.

  5. In the Filter screen, apply a filter to reduce the data displayed in the crosstab. You can select a predefined filter of the specified business view from the Filter drop-down list to apply, or select User Defined in the list to define a new filter as required.

    Create Crosstab - Filter

  6. In the Layout screen, specify the layout properties of the crosstab.

    Create Crosstab - Layout

  7. In the Style screen. specify the style of the crosstab.

    Create Crosstab - Style

    When you have specified to insert the crosstab into a banded object, by default the crosstab will inherit its parent's style. If you want to apply another style to the crosstab, uncheck the Inherit Style option and then select the required style from the Style box.

  8. Click Finish to insert the crosstab in the report.

    If you have selected a panel in a banded object as the crosstab destination, after finishing the wizard you need to click the mouse button in the destination once again in order to insert the crosstab there.

Creating a crosstab based on a query resource

Using query resources, you can create compound crosstabs. A compound crosstab contains multiple crosstabs that are mashed up together in a flexible way. Aggregations can be created based on any combinations of the row and column compound groups, making more complex analysis possible.

  1. Position the mouse pointer at the destination where you want to insert the crosstab.
  2. Click Insert > Crosstab or Home > Insert > Crosstab.

    The Create Crosstab wizard appears, which contains a set of screens for helping you define a crosstab easily. You can use the Back and Next buttons or click the screen name on the screen navigation bar to switch between the screens.

  3. In the Data screen, select the data resource in the current catalog using which to create the crosstab.

    Create Crosstab - Data

    If the predefined data resources are not what you want, you can click the first item in the corresponding resource node to create one in the current catalog. When a query is selected, click the Edit button to modify the query if required. Then a new dataset based on the selected data resource is created in the page report.

    If you want to use an existing dataset in the current page report to create the crosstab, click the More Options button and then:

  4. In the Display screen, specify the fields you want to display in the crosstab.

    Create Crosstab - Display

    The Resources box lists the DBFields in the specified data resource as well as the formulas that are valid to these DBFields in the current catalog. You can create the crosstab using these fields. If the predefined formulas cannot meet your requirement, you can click <New Formula...> in the Formulas node to create the formulas you want.

  5. In the Filter screen, add filter conditions on the fields that have been added to the crosstab to reduce the data. For how to define a filter, click here.

    Create Crosstab - Filter

  6. In the Layout screen, specify the layout properties of the crosstab.

    Create Crosstab - Layout

  7. In the Style screen, specify the style of the crosstab.

    Create Crosstab - Style

    When you have specified to insert the crosstab into a banded object, by default the crosstab will inherit its parent's style. If you want to apply another style to the crosstab, uncheck the Inherit Style option and then select the required style from the Style box.

  8. Click Finish to insert the crosstab.

    If you have selected a panel in a banded object as the crosstab destination, after finishing the wizard you need to click the mouse button in the destination once again in order to insert the crosstab there.

Besides using the wizard, you can also drag a blank crosstab to a page report that is created using query resources. To do this:

  1. From the Grid category of the Components panel, drag Crosstab button to the destination in the page report which allows the insertion of a crosstab. A blank crosstab is then created.
  2. In the Data panel, select the dataset in the current page report with which you want to create the crosstab from the dataset drop-down list, or select <Choose Data from...> from the list to create a new a dataset for the crosstab.
  3. Drag the required fields from the Data panel to create the column headers, row headers and aggregations in the crosstab.

Example of creating a compound crosstab

  1. Make sure SampleReports.cat is the currently open catalog file. If not click File > Open Catalog to open it from <install_root>\Demo\Reports\SampleReports.
  2. Click File > New > Page Report.
  3. In the Select Component for Page Report dialog, select Crosstab and click OK.
  4. In the Data screen of the Crosstab Wizard, select the query WorldWideSales in Data Source 1 of the catalog.
  5. In the Display screen, click Add button in the Rows box and two compound row groups appear in the box.

    Add Compound Row Groups

  6. Select Row Compound Group, drag and drop the formula year and the field Category in the Products table from the Resources box to the compound row group one by one, double-click in the Label text box of each field and input Year and Category to label the row headers.
  7. Select Row Compound Group 1 and add the field Country in the Customers table to it and edit its label to Country.

    Add Fields to Compound Row Groups

  8. Click Add button in the Columns box, then add the formula Quarter to Column Compound Group and the field Order ID in the Orders table to Column Compound Group 1, specify their labels as Quarter and Order ID.
  9. Select Row Compound Group in the Rows box and Column Compound Group in the Columns box, drag and drop the field Quantity in the Orders Detail table from the Resources box to the Summaries box as the aggregate field of the compound groups. Double-click in the Aggregate text box and select Sum from the drop-down list that appears, then double-click in the Label text box and enter Quantity to label the aggregations.

    Add Aggreagate Field to Compound Groups

  10. Repeat the above step to add the following fields with the specified aggregate functions as the aggregate fields for the combinations of the following compound groups. Use the fields' display names as the labels.
  11. Switch to the Filter screen and specify the filter condition as Category in Blends,Bold And Country in Australia,Belgium. Click Finish.

    Specify Filter Conditions

  12. In the Report Inspector, select Label, Label 1, QUARTER, Label 4, Label 5, YEAR, Label 6, Label 7, CATEGORY, Label 10, Label 11, Label 12, QUANTITY, QUANTITY 1, QUANTITY 2, QUANTITY 3, QUANTITY 4 and QUANTITY 5 at the same time by pressing the Ctrl key on the keyboard, specify the Background property to Lightgray.

    Set the Background Property for Objects

  13. Repeat the above step to specify the Background property of Label 2, Label 3, Order ID, Label 15, Label 16, Label 17, PRICE, PRICE 1, PRICE 2, PRICE 3, PRICE 4 and PRICE 5 to Pink, specify the Background property of Label 8, Label 9, COUNTRY, Label 13, Label 14, COST, COST 1, COST 2 and COST 3 to Orange, specify the Background property of Label 18, Label 19, UNIT PRICE, UNIT PRICE 1, UNIT PRICE 2 and UNIT PRICE 3 to Gray.
  14. Save the report and preview it. You can see the crosstab is composed of four parts, showing different summary information for different combinations of row compound groups and column compound groups.

    Preview the Report

BackPrevious Page Next PageNext