JasperReports服务器参数依赖性 [英] JasperReports Server parameter dependency

查看:83
本文介绍了JasperReports服务器参数依赖性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含两个输入参数的报告.两者都有一个我可以选择值的保管箱. 假设ParameterA和ParameterB.是否可以使ParameterB依赖于ParameterA?

I have a report which has two input-parameter. Both have a dropbox where i can select values. Let's say ParameterA and ParameterB. Is it possible to make ParameterB dependent from ParameterA?

例如:如果我在ParameterA中选择Para​​meterB中的汽车品牌"Honda",则我应该只能看到本田的所有汽车型号,例如Accord,Civic等.

for example: If i choose in ParameterA the carbrand 'Honda' in ParameterB i should only see all car models by Honda - like Accord, Civic and so on.

iReport/JasperReports Server 中是否存在这种可能性?

Is there such a possibility in iReport/JasperReports Server?

推荐答案

是的JasperReport服务器提供此功能,称为级联输入控件.

Yes JasperReport server provide this functionality which is called cascading input controls.

对于级联参数,一个参数的值列表取决于上一个参数中选择的值.

With cascading parameters, the list of values for one parameter depends on the value chosen in preceding parameter.

顺序对于级联参数很重要,因为对列表中后面的参数的数据集查询包括对列表中前面的参数的引用.

Order is important for cascading parameters because the dataset query for a parameter later in the list includes references to parameters earlier in the list.

例如,假设我们有两个输入控件,名称分别是Shipcountry和Shipcity.在这种情况下,如果选择Shipcountry,则下一个输入控件Shipcity应该仅显示属于该所选运送国家的城市.

For example suppose we have two input controls and names are Shipcountry and Shipcity, In this condition if we select Shipcountry then next input control Shipcity should show only those cities which belongs to that selected Shipping country.

在JasperSerever中,使用资源ID p_shipcountry创建一个新的输入控件,您不必为此输入控件使用数据源,只需使用以下查询:-

In JasperSerever create a new input control with resource id p_shipcountry and you do not have to use the data source for this input control, just use the bellow query:-

         SELECT DISTINCT shipcountry FROM orders ORDER BY shipcountry;

使用资源p_shipcity创建第二个输入控件,这将是级联输入控件,但是您必须使用该输入控件的数据源并使用以下查询:-

Create second input control with resource p_shipcity , which will be cascading input control, but you have to use the data source for this input control and use the bellow query:-

          SELECT DISTINCT shipcity FROM orders
          WHERE shipcountry= $P{p_shipcountry} ORDER BY shipcity;

有关更多详细信息,您可以参见这篇文章:-

For more detail you can see this post :-

级联输入控件

这篇关于JasperReports服务器参数依赖性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆