Reports: how to make a conditional band

Hello there!

I’m trying to make a template in which some of the bands are shown (and printed) conditionally.
I tried with excel or libreoffice calc setting up a ‘hidden’ or ‘no-print’ style connected to the band via conditional formatting, but it looks like the report production process messes up with it.
Is there an easier way?


1 Like

Hi Lucio,

Maybe, it would be easier to filter the data conditionally in a Groovy dataset instead of a template?

Hello Olga,
Actually I am using Groovy, but the band has other stuff in it (title, border etc…) that I don’t want to be printed if the dataset contained is empty.
I tried with the script returning an empty list but the band is created anyway.

I believe you can use Application Property reporting.putEmptyRowIfNoDataSelected = false for that purpose.
In case that band contains any static content (e.g. titles) - you can pass it also in band data ("title":"myStaticTitle").

Hi Ivan,
Yes of course the title is not a problem, but what about borders?
I’ll try with the Application Property thanks!

I think borders contain in cell properties so you just need to do few experiments with yours conditional (and nearby) rows to achieve clean report.