TAGS :Viewed: 4 - Published at: a few seconds ago

[ 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?

Answer 1


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.

For example where Charges != null condition in your table query. This should filter the invoices which does not have data for Charges.

Answer 2


I don't see why the print when expression on the band would not work.

Example: Print When Expression $F{CHARGES_FIELD_VARIABLE}!=null

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?