2016-09-20 119 views
0

我想隱藏碧玉i-report中的文本字段,當它們爲空時。如何在i-report中的字段爲空時隱藏

所以我把這種表達在這些領域的打印當表達

$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 

請幫幫我。

回答

1
  1. 消除當表達式共打印時。
  2. 檢查空白當NULL

Blank When Null

  • ,還可以選中刪除線當空(僅當您希望字段完全消失,而不是保留在網頁上的空間使用但沒有內容)。
  • Remove Line When Blank

    0

    嘗試改變順序:

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

    如果不幫助:

    這也可能取決於你的JDK(1.7/1.8)版本as seen in this question。使用1.8時,如果可能,請嘗試降級到1.7。發生這種情況是因爲1.8中的接口中有新的默認方法。