[ Dynamically hide table in JasperReports ]
I have a Report, where i list the invoices & details between a particular date range. I have a table for Charges and i have to display it only for those invoices that have charges details.Otherwise it should not be displayed and the space has to be compacted.
I have tried the solutions given in this thread
I tried applying the "Print-when" condition both on the table and the band, but it is not working for me. There is a huge space between records, that dont have the charges details.
Should i change it to a subreport instead?
I am not sure whether I have understood your question properly. If you do not want to display the records which does not have data for Charges, then I hope you can achieve this simply using a condition in your query to fetch the data.
where Charges != null condition in your table query. This should filter the invoices which does not have data for Charges.
I don't see why the print when expression on the band would not work.
Example: Print When Expression
This should only display the band if there is a value for charges.
If this does not work could you provide us with your xml?