Successfully!

Error!

You are viewing 10.0 help doc. More details are displayed in the latest help doc

Parameter query any table in the database

I. Overview

1. Expected effect

Select any table name for query, you can find out the content of the table. As shown below:

 

 

2. Implementation ideas

  • Use the TABLEDATAFIELDS() formula to get the column name of each column of the data set

  • Use the ds1.select() formula to get the contents of the corresponding column. For the use of ds1.select() formula, please refer to the use of ds1.select() and ds1.group() functions .  


II. Operation steps

1. Data preparation 

In the FineReport designer, click File>New General Report , create a new template data set ds1, the SQL statement is: select * from ${table}  

As shown below:

 


2. Template design

  • Right-click on cell A1 , select Cell Element>Insert Formula , the formula is: TABLEDATAFIELDS("ds1") 

        Right-click on cell A2, select Cell Element>Insert Formula , the formula is: ds1.select(A1) .

 

  • Select cell A1 , and select "Horizontal" in the Cell Attributes> Expand> Expansion Direction in the right property panel ; 

        Select cell A2, and select "Vertical" in Cell Attributes> Expand> Expansion Direction in the right property panel .

        The following figure shows the setting steps of cell A1, and the setting steps of cell A2 are the same as those of cell A1 . As                shown below:  

 


3. Parameter panel 

  •  Add the parameter "table" in the parameter panel, as shown in the figure below:

  • Select "Drop-down Box widget" for the widget, and the widget value is "sale";

        When setting the Data Dictionary, the type setting is selected as "Formula", and the actual value formula is: TABLES("FRDemo") .

        As shown below:


4. Preview effect 

1) PC side

Save the template, click Pagination Preview , the effect is the same as the "expected effect" in chapter I-1 of this article.


2) Mobile 

  • APP

  • HTML5

 


III. Completed template 

For the completed template, please refer to: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Parameter\DynamicSQL\Parameter_query_any_table_in_the_database.cpt

Click to download the template: Parameter_query_any_table_in_the_database.cpt

Attachment List


Theme: Parameter
Already the First
Already the Last
  • Helpful
  • Not helpful
  • Only read

Doc Feedback