问题描述
最近,当用户在输入控件中输入空值时,我得到了一些分组帮助(。我正在使用iReport / JasperServer Professional 4.5.1。我的三个分组级别是药房,设施和包装类型。
Recently I got some help with grouping when a user enters a null value into an input control ("Rolling up" groups in Jaspersoft iReport). I am using iReport/JasperServer Professional 4.5.1. My three levels of grouping are pharmacy, facility, and packaging type.
将报告部署到 JasperServer
后,我我在使用null时遇到了一些麻烦。我取消选中始终提示输入控件,当报表第一次打开时,它的行为就好像它已经适当地接收了所有输入控件和组的空值(这就是我想要的)。我的输入控件的显示模式是在页面中,因此它们显示在屏幕的左侧。然后,当我尝试选择一个药房并重新运行报告时(期望设施和包装类型的聚合值,因为我没有为这些控件选择任何内容),报告的执行方式就像聚合代码不存在一样,并且列表所有设施和所有包装类型。
After deploying the report to JasperServer
, I am having some trouble with nulls. I unchecked "always prompt" for my input controls, and when the report opens the first time it acts as though it has received null values for all input controls and groups appropriately (which is what I want). The display mode for my input controls is "in page", so they're displaying on the left-hand side of the screen. When I then try to select one pharmacy and re-run the report (expecting aggregate values for facilities and packaging types, since I didn't select anything for those controls), the report performs like the aggregate code doesn't exist, and lists all facilities and all packaging types.
但是 - 如果我将一个选定的药房保存为已保存的输入控件,则返回存储库并使用保存输入控件,它工作正常,并聚合所有设施和包装类型数据。
However - if I save that one selected pharmacy as a saved input control, then go back out to the repository and run the report using the saved input control, it works fine, and aggregates all facility and packaging type data.
有任何想法吗?
谢谢,
Lisa
Thanks,
Lisa
推荐答案
我的输入控件是多选查询,我的参数是集合。我发现当我第一次通过单击存储库中的链接进入报告时,报告被发送为空值。但是,当我在JasperServer中打开报表后再次尝试运行报表时,我生成了空列表。
My input controls are multi-select queries and my parameters are collections. I discovered that when I first entered the report by clicking on the link in the Repository, the report was being sent null values. However, when I was trying to run the report again after opening it in JasperServer, I was generating empty lists.
Matthew Dahlman建议我在iReport中创建参数来处理空值并卷起我的分组。这些参数如下所示:
Matthew Dahlman suggested I create parameters in iReport to handle null values and "roll up" my grouping. Those parameters looked like:
$P{packtype}==null ? " 'All Package Types' " : " FAC.PACKTYPE_CODE "
在iReport中首次使用效果很好在JasperServer中打开报告。要处理空列表和空值,我必须将我的参数更改为:
That works beautifully in iReport and on first opening the report in JasperServer. To handle an empty list AND null values, I had to change my parameters to:
$P{packtype} == null ? " 'All Package Types' " :
($P{packtype}.isEmpty() ? " 'All Package Types' " :
" FAC.PACKTYPE_CODE ")
这篇关于JasperServer - 输入控件的空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!