Situation where the data remains unchanged when different parameters are entered during the report creation process - Report Creation Tool Special Knowledge Base - CSDN Blog

by wszff on 2010-11-23 18:19:57

During the process of creating reports, there may be instances where the data remains unchanged when different parameters are entered for querying.

In practical applications of some mainstream report creation software, such situations are quite common. When previewing in the designer, the data changes normally with the input parameter values. However, when performing a paginated preview in a browser, changing the parameter values results in the queried data in the report remaining unchanged. For this situation, one possible reason (especially in J *** a reporting tools) is that the name of the parameter control in the parameter interface does not match the actual parameter name, necessitating verification of the control name. This error often occurs during the report creation process when a template has already been completed, but the parameter definition has been modified without making corresponding adjustments to the parameter interface. Below is an example demonstrating this:

1. **Create a new report**.

2. **Define the dataset**: Create a new database query named `ds1` and define the data source parameter as `class`. The SQL statement is:

```sql

SELECT * FROM STSCORE WHERE ClassNo = '${class}'

```

3. **Create the template**: Design the report accordingly.

4. **Define the parameter interface**: Use the default parameter interface as shown below:

5. **Modify the parameter definition**: Due to requirements, change the data source parameter name to `classno`, such as:

```sql

SELECT * FROM STSCORE WHERE ClassNo = '${classno}'

```

However, the parameter interface is not updated accordingly, and the parameter control name remains `class`, as shown below:

6. **Save and preview**: Save the template and perform a designer preview. Assigning a value to `classno` produces correct results. However, when clicking on the paginated preview in the designer, setting the parameter value in the parameter interface causes an issue. The value entered in the parameter interface is assigned to the parameter control, which maps to the parameter based on the control name. In this case, the control name is still `class`, while the parameter has changed to `classno`. Therefore, the parameter cannot correctly obtain the value, resulting in an incorrect query result.

Article source: http://aj *** areport.cn/archives/557