Overview
Version
| Report Server Version | Functional Change |
|---|---|
11.0 | / |
Expected Effect
In some cases, you need to select different parameters to display different template content. For example, you can display different summary reports according to the summary types selected by the radio button group, as shown in the following figure.

Implementation Method
To display different columns in a report by using the parameter widget, you can use the following two methods.
Method one: You can display different columns in a report by adding condition attributes.
Method two: You can display different columns in a report by the SQL statement.
Method One: Adding Condition Attributes
Data Preparation
Create a dataset named ds1 with the SQL statement SELECT * FROM Sales_Volume.
Component Creation
Drag the Region and Salesperson fields into the corresponding cells, set different summary methods separately, and design the table style, as shown in the following figure.

Adding Parameter Widgets
First, add the template parameter type, as shown in the following figure.

Add a radio button group widget and a query button widget to the parameter panel, and name the radio button group widget type. In the Data Dictionary setting box, set Type to Custom, and customize two options, as shown in the following figure.

Setting Condition Attributes
Select cells A1 and A2, right-click the cells, and select Condition Attribute. Click +, set Attribute to Row Height, set Row Height to 0, and add the formula condition $type!='Region'. Similarly, select cells A3 and A4, set Attribute to Row Height, set Row Height to 0, and add the formula condition $type!='Salesperson' in the condition attribute setting box, as shown in the following figure.

Save the template and click Pagination Preview. In this case, you can realize the effect.
Effect Display
PC
The effect is the same as that shown in section "Expected Effect."
Mobile Terminal
The following figure shows the display effect on the DataAnalyst app and HTML5 terminals.

Example Two: Using the SQL Statement
General Report Creation
Choose File > New General Report, as shown in the following figure.

Adding the Parameter Widget
Add the radio button group widget, name the widget type, and add a query button widget, as shown in the following figure.

Data Preparation
Create a dataset ds1 with the SQL statement:
SELECT${if(type="Region","Region","Salesperson")} as a,sum(Sales_Volume) num
FROM Sales_Volume
${if(type="Region","group by Region","group by Salesperson")}
The default value of the parameter type is East China, as shown in the following figure.

Template Creation
Drag the a and num fields into the corresponding cells, center the fields, and set borders for the cells, as shown in the following figure.

Setting the Widget Parameter

Save the template and click Pagination Preview. In this case, you can realize the effect.
Effect Display
PC
The effect is the same as that shown in section "Expected Effect."
Mobile Terminal
The effect is the same as that shown in section "Mobile Terminal" in section "Method One: Adding Condition Attributes."
Template Download
1. Method one: adding condition attributes
For details, you can download the template Displaying Different Columns Based on Parameter Values.cpt.
2. Example two: using the SQL statement
For details, you can download the template Displaying Different Columns by the SQL Statement.cpt.