I. Overview
1) Expected effect
Linkage of drop-down list of drop-down box parameters can be realized through Drop-down box parameter linkage In use, the first value in the drop-down list should be selected by default, and the effect is shown in the following figure:
2) Implementation roadmap
The displayed content can be changed by assigning the value of the parameter panel control, combined with SQL function query to query the first parameter corresponding to the value in the database, you can achieve the required results.
II. Example
1. Setting the customer drop-down box widget
1) Open the template %FR_HOME%\WebReport\WEB-INF\reportlets\doc-EN\Parameter\The_first_value_in the_default_selection_list_for_dropdown_box_linkage.cpt
2) SELECT the "customer" drop-down box widget in the parameter panel, and select the widget value formula. Enter the formula: SQL ("FRDemoEN","SELECT CUSTOMERID FROM ORDERS ",1,1), so that the order will be displayed by default during report preview, as shown below:
2.Setting the EMP drop-down box widget
Select the "EMP" drop-down box widget, and also set the widget value as a formula:
if(len($Customer)=0,'',sql("FRDemoEN","SELECT EMPID FROM ORDERS where CUSTOMERID= '"+$Customer+"'",1,1))
As shown below:
Note 1: The sample template uses dynamic SQL to set the data dictionary for the [EMP] drop-down widget. Alternatively, you can skip the dynamic SQL method and directly add the formula to the data dictionary setting dialog box: sql('FRDemoEN','SELECT EMPID FROM ORDERS where CUSTOMERID="'+$Customer+'"',1)
Note 2: Note the use of single and double quotation marks. In the first case, like "% XXX "becomes like '% XXX '.
3.Setting the Ship drop-down list widget
Select the "Ship" drop-down box widget and also set the widget value to the formula:
if(len($Customer)=0||len($EMP)=0,"",sql("FRDemoEN","SELECT SHIPMETHOD FROM ORDERS where CUSTOMERID = '"+$Customer+"' and EMPID = '"+$EMP+"'",1,1))
Note 1: The sample template uses dynamic SQL to set the data dictionary for the "Ship" drop-down widget. Alternatively, you can skip the dynamic SQL method and add the formula directly to the data dictionary setting dialog:if(len($Customer)=0||len($EMP)=0,'',sql('FRDemoEN','SELECT SHIPMETHOD FROM ORDERS where CUSTOMERID="'+$Customer+'" and EMPID="'+$EMP+'"',1,1))
Note 2: The SQL assigned to the widget value must match the corresponding widget data dictionary query, otherwise the result may be wrong
III.Effect preview
1) PC
See section I of this article.
2) Mobile
Support app and HTML5 view
IV. Download the template
For the completed template, see %FR_HOME%\WebReport\WEB-INF\reportlets\doc-EN\Parameter\The_first_value_in the_default_selection_list_for_dropdown_box_linkage.cpt
Click to download the template:
The_first_value_in the_default_selection_list_for_dropdown_box_linkage.cpt