【问题标题】:How to hide while fields are empty in i-report如何在 i-report 中的字段为空时隐藏
【发布时间】:2016-09-24 00:01:17
【问题描述】:

我想在 jasper i-report 中的文本字段为空时隐藏它们。

所以我把这个表达式放在那些字段的 Print When Expression

$F{field_cashPaymentReceiptMode} != null && !"".equals($F{field_cashPaymentReceiptMode}) 

但是我在编译报告时遇到了错误。

net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files
                value = ((java.lang.String)field_cashPaymentReceiptMode.getValue())!=null &&!"".equals(((java.lang.String)field_cashPaymentReceiptMode.getValue())); //$JR_EXPR_ID=33$
                                                                                             <-------------------------------------------------------------------->
1 errors

请帮帮我。

【问题讨论】:

    标签: jasper-reports


    【解决方案1】:
    1. 完全消除Print When Expression
    2. 检查空时为空

    1. (可选)选中Remove Line When Blank(仅当您希望该字段完全消失,而不是在页面上保留其空间但没有内容时才使用此选项)。

    【讨论】:

      【解决方案2】:

      尝试更改顺序:

      ... && !$F{field_cashPaymentReceiptMode}.equals("")
      

      如果这没有帮助:

      这也可能取决于您的 JDK (1.7 / 1.8) 版本 as seen in this question。使用 1.8 时,如果可能,请尝试降级到 1.7。发生这种情况是因为 1.8 中接口中的新默认方法。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-10-02
        • 1970-01-01
        • 2013-09-03
        • 1970-01-01
        • 1970-01-01
        • 2019-10-20
        相关资源
        最近更新 更多