I. Overview
1. Requirement description
The previous chapter introduced the parameter linkage of drop-down box. When the parameter widget is a drop-down check box, how to achieve the same linkage effect? As shown in the figure below, the product type option will change with the value selected by the region, and the product option will change with the value selected by the region and product type.
2. Implementation ideas
The new dataset is used as the data dictionary of each parameter box, and the previous parameters are referenced in the later parameter box data set for filtering.
II. Operation steps
1. Data preparation
Create a new normal report and a new data set DS1. The SQL statement is as follows:
SELECT * FROM Sales_Volume
where Region in ('${region}') and Product_Types in ('${pdtypes}') and Product in ('${pd}')
Because the parameter widget is a check box, the in statement is required for parameters in the dataset
2. Design form
As shown in the figure below, design the table and drag the field into the corresponding cell.
3. Add parameter widget
In the edit parameter pane, click add all to generate the parameter widget. Click the parameter box of region, product type and product to select the drop-down check box widgets.
4. Add parameter box data set
1) Region
New dataset region option: SELECT distinct Region FROM Sales_Volume. Since region is the first parameter, linkage filtering is not required (the distinct keyword here is for reducing duplication)
2) product type
New dataset pdtype:
select distinct Product_Types from sales_volume
where Region in( '${region}')
3) Product
New dataset product:
SELECT Product FROM Sales_Volume
where Region in ('${region}') and Product_Types in ('${pdtypes}')
Because product need to display corresponding product types according to different region and product types, region and product type filtering parameters need to be set.
5. Setting data dictionary of parameter widget
1) Select the region drop-down check box widget, the widget name is region, the data dictionary is set as data query, the dataset is set as region, the actual value and display value are both Region, the return value type is set as string, and the separator is', '(that is, a comma is added in the middle of the single quotation mark. The setting of the separator here is to separate the selected parameter values. For example, when North China and Central China are selected as regions, the return values are 'North China' and 'Central China')
Note 1: the widget name of region and product type widgets must be consistent with the parameter name of provduct type and product dataset before linkage.
Note 2: the separator must be entered in English half width.
2) Select the product type drop-down check box widget, the widget name is product type, the data dictionary is set as data query, the dataset is set as product type, the actual value and display value are both product type, the return value type is set as string, and the separator is ', '.
3) Select the product drop-down check box control, the control name is product, the data dictionary is set as data query, the dataset is set as product, the actual value and display value are both product, the return value type is set as string, and the separator is ', '.
6. Effect preview
1) PC preview
Save the template and click pagination preview. The effect is as I.1 shows:
2) Mobile terminal
Preview the template on the mobile end, as shown in the following figure:
III. Template download
For completed templates, please refer to:
%fr_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Parameter\Dd_CheckBox_para.cpt
Click to download the template: