问题
I'm currently trying to create a JasperReport report with some special input control behaviour. My needs are:
- four input controls, two of them are dateboxes, the other ones are radio buttons
- depending on radio button choice, one of the databoxes should be visible or not
- so if option 1 is chosen, show both dateboxes; if option 2 is chosen, show only one datebox
I wonder if there's a "clean" solution - didn't find anything.
Any pointers will be helpful.
回答1:
The Print when expression is not relevant for input controls on JasperReports Server.
There is no built-in support for hiding and showing an input control based on the value of a different one. The infrastructure for cascading input controls can certainly be extended to achieve this... but it would not be trivial.
The path I would take is to customize the .jsp page that displays the input control. There is a section in the JasperReports Server Ultimate Guide called "Customizing the Input Controls Form" which would get you started down this path.
回答2:
For datebox part, you can use print when expression
to decide whether certain blocks of the report is visible.
For other "input", if you meant some data you want to display inside the report, you can make some Parameter
in your report, then set the Parameter
from user input before you export the report.
来源:https://stackoverflow.com/questions/10443938/jasperreports-dynamic-input-controls