Overview
Version
| Report Server Version | Functional Change |
|---|---|
| 11.0 | / |
Expected Effect
You can select a table name and click Query to display the corresponding content of the table, as shown in the following figure.

Implementation Method
You can use the TABLEDATAFIELDS() formula to obtain the column name of each column in the dataset.
You can use the ds1.select() formula to obtain the content of the corresponding column. For details about the use of the ds1.select() formula, see Overview of Dataset Functions.
Procedure
Data Preparation
Choose File > New General Report in the FineReport designer, and create a dataset ds1 with the SQL statement select * from ${table}, as shown in the following figure.

Template Design
1. Right-click cell A1, choose Cell Element > Insert Formula, enter the formula TABLEDATAFIELDS("ds1"), and click OK, as shown in the following figure.

2. Right-click cell A2, choose Cell Element > Insert Formula, enter the formula ds1.select(A1), and click OK, as shown in the following figure.

3. Set the expansion direction of cell A1 to Horizontal and the expansion direction of cell A2 to Vertical. For example, the following figure shows the steps of setting cell A1.

Parameter Panel
1. Add the parameter table on the parameter panel, as shown in the following figure.

2. Select Drop-down Box Widget for the widget and enter sale in Widget Value.
Set Type to Formula and enter the formula TABLES("FRDemo") for Actual Value in Data Dictionary, as shown in the following figure.

Preview Effect
PC
Save the template and click Pagination Preview. The effect is the same as that shown in section "Expected Effect."
Mobile Terminal
The preview effects on the DataAnalyst app and the HTML5 terminal are the same, as shown in the following figure.

Completed Template
The completed template can be found in %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Parameter\DynamicSQL\Parameter_query_any_table_in_the_database.cpt.
For details, you can download the template Parameter Query for Any Table in the Database.cpt.