Would like to display “To be contined” for all pages in report and for last report “End of report” has to be displayed using iReport

て烟熏妆下的殇ゞ 提交于 2019-12-31 06:48:10

问题


I have designed an iReport where it should display all the records in the report. If a report has 2 pages for example then first page should display "To be continued" second page should display "End of the report" irrespective of number of pages you are working with.

I have placed a label at the footer of the report and changed the properties "print when expression" as

$V{PAGE_NUMBER}.equals($V{PAGE_COUNT}.toString()) ? "End of Report" : "Continue"

and displays error while executing the report

Error filling print... java.lang.String cannot be cast to java.lang.Boolean 
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean 

回答1:


The property that you should fill is Text field expresion and change by:

$V{PAGE_NUMBER}.equals($V{PAGE_COUNT}) ? "End of Report" : "Continue"

because you are comparing Integers.

Your text field in the xml should be:

<textField>
    <reportElement x="xx" y="xx" width="xx" height="xx" uuid="xxxx"/>
    <textElement textAlignment="xxx" verticalAlignment="xxx">
        <font fontName="xx"/>
    </textElement>
    <textFieldExpression><![CDATA[$V{PAGE_NUMBER}.equals($V{PAGE_COUNT}) ? "End of Report" : "Continue"]]></textFieldExpression>
</textField>


来源:https://stackoverflow.com/questions/27125249/would-like-to-display-to-be-contined-for-all-pages-in-report-and-for-last-repo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!