Reputation: 3717
I want to compare date with current date but I am not getting how to represent current date in jrxml. Code is something like this
<textFieldExpression class="java.lang.String">
<![CDATA[ $F{dueDate} > [new java.util.Date()] ? "some value" : "some other value" ]]>
</textFieldExpression>
Can you please tell me correct representation of this code?
Upvotes: 0
Views: 3192
Reputation: 181
Try using the before()
method in the java.util.Date
class when comparing the two dates. The following example worked for me:
<textFieldExpression class="java.lang.String"><![CDATA[($P{date1}).before(new java.util.Date()) ? "aaa" : "bbb"]]></textFieldExpression>
If you want to check the value you get for new Date(), you can put it in a textfield and print it somewhere in your report.
Upvotes: 3