Jump to content

pb with printWhenExpression


jbeausse

Recommended Posts

Hi all,

 

My objective is very simple : display a "no data found" message in a report when no data is available.

 

I use velocity to generate JRXML dynamically, and this message might be used in different contexts (subreports, etc.).

 

The solution I found :

 

Code:

* * * my detail * * *
</detail>
<!-- a column footer with the message -->
<columnFooter>
<band height="30" isSplitAllowed="true">
<textField isStretchWithOverflow="true" evaluationTime="Report">
<reportElement x="0" y="0" width="510"
height="30"
style="noDataFound">
<printWhenExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()==0)]]></printWhenExpression>
</reportElement>
<box border="Thin" borderColor="#FF0000" />
<textFieldExpression class="java.lang.String"><![CDATA[$R{labels.nodatafound}]]></textFieldExpression>
</textField>
</band>
</columnFooter>

 

Imagine that this detail is displayed in a subreport, and that I don't have enough space to display the first element (end of a page).

 

My problem is that even if I use the "Report" evaluationTime in my textField, it seems that the printWhenExpression is evaluated *at the end of each column*, so if there is not enough space to display an element, the message is displayed (see attachment).

 

PS : I'd prefer not to use a summary section/fake group since it complicates my work a lot !

 

Thn'x

 

Julien

 

JR version : 1.2.8

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...