How to achieve cascading parameter query

Cascading parameter query is a query interaction between controls, such as after a drop-down box option is selected, the other options in drop-down box will change. Report Run Dry offers a variety of editing styles, each style has a rich edit the properties, in order to achieve cascading parameter query is based on very simple. Here explained through an example implementation.

Requirements: parameter template in urban areas based on linkage, such as the North China region selection, behind the city can only select a city in North China. Illustrated as follows:

Specific steps are as follows:

1 connected to a data source

Run Dry report designer using the connection carrying a data source demo

2 edit template parameters

1) New Report, select the type of report, "Report Parameters":

2) set the report data set ds1:

Dataset SQL: select distinct regional shippers, cargo owners from the city orders

3) Edit Report expression:

B2 set "Edit style" is a set of pull-down data, editorial style settings as shown:

Similarly, pull-down data set D2 is provided as follows:

The associated input filter expression: owner area == B2, and set the trigger cell is associated filtration: B2, complete linkage setting parameters.

When using pull-down data sets need to pay attention :

● display column values ​​down data set can not contain commas or semicolons. This is because the display column corresponding to the value selection pull-down data set, and drop-down selection between data sets in the system are spaced a comma or a semicolon, if a value of the display column contains commas or semicolons, then this system will display a column value is split into two selections according to a comma or semicolon in handling.

● down data cell can not use the set of wrap property. Otherwise, the pull-down property is not available.

After ● display column values ​​down data set if it contains carriage return line, special characters, marks or the like, may use "associated filtering" properties, impact on JavaScript, in order to shield the effects of these characters, the "clear special character" options can be checked on.

● If the data set has the same value different from the display data corresponding to the value, then the value displayed if the selected duplicate, you can return the data values; duplicate if the input value is displayed, only displaying values ​​corresponding to the duplicate return of a value of the data.

4) Set the variable name web

为了把参数传递给数据报表,设置 B2 和 D2 格的变量名分别为 area 和 city,前者设置如下图:

3 编辑数据报表

数据报表用于接收参数模板中传递的参数,从而进行数据过滤展现。

1)新建报表并设置报表参数,参数名与参数模板的变量名一致:

2)设置报表数据集:

数据集 SQL 为: SELECT 订单. 订单 ID, 订单. 货主地区, 订单. 货主城市, 订单. 发货日期, 订单. 运货商, 订单. 运货费 FROM 订单 where 货主地区 =? and 货主城市 =?

其中,问号(?)与参数选项卡中的参数对应:

3)编辑报表表达式:

通过以上步骤即可完成参数联动报表的开发,结合发布报表的页面即可得到开篇中看到的参数联动查询效果。

Guess you like

Origin www.cnblogs.com/shiGuangShiYi/p/12113499.html