JasperServer - null values for input controls

心已入冬 提交于 2019-12-02 15:28:26

问题


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.

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.

Any thoughts?

Thanks,
Lisa


回答1:


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 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 " 

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 ")


来源:https://stackoverflow.com/questions/11082379/jasperserver-null-values-for-input-controls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!