I. Overview
1) Problem description
The current multi-select drop-down tree does not have the function of selecting all. Therefore, selecting all is troublesome when there are many root nodes. So how to achieve the default full selection of the multi-selection drop-down tree?
2) Implementation roadmap
The default values of the multi-select drop-down tree are in the following formats: Headquarters, Finance department, Director; Headquarters, Finance department, accounting. You can concatenate several columns of a drop-down tree data dictionary in SQL to construct a default value format. Then use the JoinArray () function in the widget value to concatenate a string as the default value.
Note: This scheme has some limitations on the data structure, so it needs to write SQL to output the field values that meet the format requirements of the default values of the drop-down tree.
II. Examples
1. Preparing data
SQL statement: SELECT Country FROM Client where Country!=''
SQL statement: SELECT Region FROM Client where Region!='' and Country='${layer1}'
Dataset ds3, according to the first two layers of layer1, layer2 value query city, SQL statement is:SELECT City FROM Client where City!='' and Country = '${layer1}'and Region='${layer2}'
Note: This is referenced by layer1, Layer2, and so on. Layer1 and Layer2 are predefined and cannot be changed.
2. Report design
1) Drag the parameter panel into the drop-down tree widget.
2) Select the Attribute>Advanced>Data Dictionary, the construction method of ordinary layered construction, select the dataset corresponding to each layer.
Level 1:
Level 2:
Level 3:
3. Concatenate to build defaults
1) Create a new dataset ds4, SQL statement is: select Country||','||Region||','||City from Client where Country !="" and Region !="" and City !=""
Note: You need to modify the SQL as required and output the complete path of each node value. If the return leaf node is set, the SQL concatenated node cannot have a directory node.
2) Select the widget from the drop-down tree and enter the following formula in Widget Settings>Attributes>Advanced > Widget Value.Enter the following formula:JOINARRAY(Value (" ds4 ",1),";" )
4. Effect preview
Save the template and click Pagination Preview. The effect is as follows:
III. Download the template
The template has been completed, please refer to: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Parameter\Drop-down_tree_widgets_are_selected_all_by_default.cpt
Click to download the template:
Drop-down_tree_widgets_are_selected_all_by_default.cpt