### Inserting a crosstab

To insert a crosstab into a report, use either of the following two ways:

- Using dialog
  1. Position the mouse pointer at the destination where you want to insert the crosstab. A crosstab can be inserted in the report areas listed in Component placement.
  2. Do one of the following to open the Create Crosstab wizard:
     - Click Insert > Crosstab on the menu bar.
     - Click the Insert Crosstab button on the Insert toolbar.
  3. In the Data screen of the wizard, define or select the dataset on which the crosstab will be created.
     - New
       If checked, the crosstab will be built on a new dataset created from the catalog resources.
     - Existing
       If checked, specify the dataset in the current report set from which the crosstab will be created.
     - Current
       If checked, the crosstab will be built on the dataset which is used by its parent.
  4. In the Display screen, add the required fields from the Resources panel to the Columns and Rows boxes respectively, and set the other settings according to your requirements.
  5. Add the fields as aggregate fields to the Summaries box, and specify the aggregate functions for the added fields as required. If necessary, click the Comparison Function button to set the comparison function.
  6. To apply some filters to the crosstab so as to reduce data displayed in the crosstab, go to the Filter screen and define the filter conditions as required.

     To define a filter condition, click the Add Condition button to add a condition line, then from the field drop-down list, select the field on which the filter will be based, set the operator with which to compose the filter expression from the operator drop-down list, and in the value combo box, type the value of how to filter the field or select the value from the drop-down list.

  7. In the Layout screen, specify the layout of the crosstab as required.
  8. In the Style screen, set a style for the crosstab.

     If 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. For more information, see Inheriting the style from a data container.

  9. Click Finish to insert the crosstab.

     If you have specified to insert the crosstab in the report body, the crosstab will be inserted there upon clicking the Finish button; otherwise, click the mouse button in the location to insert the crosstab.

- By dragging and dropping
  1. From the Toolbox panel, drag Crosstab to the destination in the report where allows the insertion of a crosstab, and a blank crosstab will then be created.
  2. In the Resource View panel, select the dataset you want to use in the crosstab from the dataset drop-down list. If you want to create a new dataset for the crosstab, select <Choose Data from...> from the list and new a dataset in the New Dataset dialog as required.
  3. Drag the required fields in the specified dataset from the Resource View panel to the position of row header, column header or aggregate in the crosstab. Then the rows, columns and aggregates will be created.

When a crosstab has been created, you can customize its appearance and behavior by setting properties in the Report Inspector, which can be saved as a CSS style for future use (for details, see Creating a CSS style).

Note: When you want to create a crosstab on a hierarchical data source, pay attention to the unique features of HDS. For details, refer to Developing reports from HDS.