Expanding and Collapsing a Crosstab
If a crosstab has more than one row/column group level, you can specify whether or not to enable the crosstab to be expanded at runtime, and set the default expanding/collapsing state of groups in the outer level. This behavior is controlled by two properties: Expand Data and Expand Detail Data.
- Expand Data: A property on both crosstab, and DBField or formula added into crosstab as a dimension (group level). This property on crosstab controls whether or not to enable end users to expand/collapse dimensions in a crosstab, and when it is enabled, you can use the property on DBFields or formulas to specify whether this dimension can be expanded/collapsed respectively.
- Expand Detail Data: A property on DBFields or formulas added into the crosstab as a dimension (group level). It specifies whether or not to display the details of this field by default.
Note: These two properties work only in continuous page mode, so they are supported for page report only, and after setting the two properties, if you have further modified the crosstab layout, they may not take effect.
The following example shows how to use the two properties:
- Open the catalog file SampleReports.cat in
<install_root>\Demo\Reports\SampleReports
. - Create a crosstab report on the query WorldWideSales in Data Source 1 of the catalog as follows: add Product Type Name and Category in the Products table as the column fields, Region, Country and State in the Customers table as the row fields, Quantity in the Orders Detail table as the aggregate field and specify Sum as the aggregate function, set the crosstab to be Vertical Layout (Number of Rows: 1), and apply the style Classic to the crosstab.
- In the Report Inspector, set the Expand Data property of the crosstab to true.
- Set the Expand Data property of the DBField Country to false, and the Expand Detail Data property of the DBField Product Type Name to false.
- Uncheck Page Layout on the View menu.
- Save the crosstab.
- Select View > Preview As > Page Report Result to preview the report. You can then select the buttons with a plus or minus sign to expand/collapse the Region and Product Type Name dimensions, and since the Expand Detail Data property of Product Type Name is set to false, you will find the details of this dimension are not expanded by default.