Search code examples
jasper-reports

Print a field when certain value is not present Jasper reports


I am creating a JasperReports's report using iReport. I have a date field where once instance is 01-JAN-1900. I need any time the date field has this value then null value is printed. I have tried this:

<textField pattern="dd-MMM-yyyy" isBlankWhenNull="true">
                    <reportElement uuid="4dd05795-8363-4cf3-ad30-239aac3a086f" x="3" y="0" width="63" height="15">
                        <printWhenExpression><![CDATA[$F{TRAN_DATE} != "01-JAN-1900"]]></printWhenExpression>
                    </reportElement>
                    <textElement>
                        <font size="9"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{TRAN_DATE}]]></textFieldExpression>
                </textField>

But the value is still getting printed. How do I achieve this?


Solution

  • You cannot compare dissimilar types. Drop the String literal and compare datetime types.