I. Overview
1) Expected effect
When making a parameter interface, it is hoped that the data of the drop-down widget is dynamic, as shown in the following figure. After the front widget selects a region, the drop-down box widget behind it will display the data of the region. If the front widget selects a city, the next drop - down box shows the data for the city. How to achieve this?
2) Implementation roadmap
By setting two parameters, set the value of the parameter to the formula, judge the value of the first parameter through the if condition in the formula, and finally extract the corresponding data column through the sql function.
II. Steps
1. Adding template parameters
Create a general report, click "Template >Template Parameters", and add template parameters p1 and p2, as shown below:
2. Adding drop-down box widgets
Enter the parameters panel, click"Add All" button on the right to add the drop-down box widget, as shown below:
3. Setting drop-down box widgets
1) Setting the p1 drop-down box widget
Select the P1 drop-down box widget and select "Custom" for data dictionary type setting. The actual value is the same as the displayed value, which is "Region" and "City" respectively, as shown in the following figure:
2) Setting the p2 drop-down box widget
Select the P2 drop-down box widget, set the data dictionary type to "Formula", and enter the formula for the actual value:
if($p1='City',sql("FRDemoEN","select City from Client",1),if($p1='Region',sql("FRDemoEN","select
Region from Client",1),""))
For details about the SQL functions used in the formula, see SQL functions
4. Effect viewing
1) PC
Save the template and click the Pagination Preview to see what it looks like in Section I of this article.
2) Mobile
The end effect of App and HTML5 is as follows:
III. Download the template
For the completed template, see: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc\Parameter\Drop-down_box_implements_data_dictionary_linkage.cpt
Click to download the template:
Drop-down_box_implements_data_dictionary_linkage.cpt