How to conditionally render an element with JasperReports?
I want to render a specific element in my jasper report only if a specific condition is met in my data model, what is the best way to achieve this?
3068 views
I want to render a specific element in my jasper report only if a specific condition is met in my data model, what is the best way to achieve this?
3068 views
In my specific case it helped to add a <printWhenExpression>
element as a child of the <band>
element I wanted to hide conditionally.
You can write an expression into the <printWhenExpression>
Tag and only when this expression is met the element will be rendered. Here is an example where the expression checks if the specific String as hat least one character.
<band>
<printWhenExpression><![CDATA[$F{myString}.length() > 0]]></printWhenExpression>
...
</b>