I. Overview
1. Application scenarios
I hope to be able to query the database table information under the data connection through parameters on the report preview page, as shown in the following figure:
2. Implementation ideas
Use the FIELDS() formula to get the field name
Use the RECORDS() function to get the field value
For the introduction and usage of the formula, please refer to the document: Report Function
II. Example
1. Parameter setting
1) Create a new general report
ClickTemplate>Template Parameters on the menu bar to create two new template parameters, as shown in the figure below:
cone : used to point to the data connection
tabl : used to point to the database table
2) Add the above two template parameters to the parameter panel
Select the drop-down box widget for the widget type.
3) Set the data dictionary
The binding parameter cone corresponds to the data dictionary of the drop-down box widget. The data dictionary type is Custom , and the actual value and display value are filled in as the name of the data connection, as shown in the following figure:
4) The binding parametertabl corresponds to the data dictionary of the drop-down box widget. The data dictionary type is formula, the actual value is the formula tables($cone) , and the displayed value is the formula $$$ .
Note: For the use of formulas, please refer to the document:JS Implementation can Automatically Query without Clicking the Query Button
2. Report design
Design the table as shown below
Select cell A1 , insert the formula: FIELDS($cone,$tabl) , and set the expansion direction to Horizontal expansion .
Select cell A2 and insert the formula: RECORDS($cone,$tabl,$a1) , the upper parent cell is A1, and the expansion direction is set to Vertical expansion.
3. Effect preview
1) PC terminal
Save the report, click the Pagination Preview , the effect is as shown in the Application scenario.
2) Mobile
III. Template download
The completed template can be found in: %FR_HOME%\webroot\WEB-INF\reportlets\doc-EN\Parameter\Parameter_query_data_connection_and_database_table.cpt
Click to download the template: Parameter_query_data_connection_and_database_table.cpt