Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jasper string functions method undefined error

Using Jasper Reports 5.6.1. Added some text functions to a previously working text field jrxml (just want to truncate if longer than 75 chars). Works in iReport Studio, but not in Java.

<textFieldExpression><![CDATA[IF(LEN($F{AccountName})<75,$F{AccountName},LEFT($F{AccountName},75)+"...")]]></textFieldExpression>

Error message:

Error occured while trying to fetch the HTML Output from the Jasper     Service (Errors were encountered when compiling report expressions class file:
1. The method LEN(String) is undefined for the type ICC_1422636250096_198427
            value = IF(LEN(((java.lang.String)field_AccountName.getValue()))<75,((java.lang.String)field_AccountName.getValue()),LEFT(((java.lang.String)field_AccountName.getValue()),75)+"..."); //$JR_EXPR_ID=9$
                       <->
2. The method LEFT(String, int) is undefined for the type ICC_1422636250096_198427
            value = IF(LEN(((java.lang.String)field_AccountName.getValue()))<75,((java.lang.String)field_AccountName.getValue()),LEFT(((java.lang.String)field_AccountName.getValue()),75)+"..."); //$JR_EXPR_ID=9$
                                                                                                                                 <-->
3. The method LEN(String) is undefined for the type ICC_1422636250096_198427
            value = IF(LEN(((java.lang.String)field_AccountName.getOldValue()))<75,((java.lang.String)field_AccountName.getOldValue()),LEFT(((java.lang.String)field_AccountName.getOldValue()),75)+"..."); //$JR_EXPR_ID=9$
                       <->
4. The method LEFT(String, int) is undefined for the type ICC_1422636250096_198427
            value = IF(LEN(((java.lang.String)field_AccountName.getOldValue()))<75,((java.lang.String)field_AccountName.getOldValue()),LEFT(((java.lang.String)field_AccountName.getOldValue()),75)+"..."); //$JR_EXPR_ID=9$
                                                                                                                                       <-->
5. The method LEN(String) is undefined for the type ICC_1422636250096_198427
            value = IF(LEN(((java.lang.String)field_AccountName.getValue()))<75,((java.lang.String)field_AccountName.getValue()),LEFT(((java.lang.String)field_AccountName.getValue()),75)+"..."); //$JR_EXPR_ID=9$
                       <->
6. The method LEFT(String, int) is undefined for the type ICC_1422636250096_198427
            value = IF(LEN(((java.lang.String)field_AccountName.getValue()))<75,((java.lang.String)field_AccountName.getValue()),LEFT(((java.lang.String)field_AccountName.getValue()),75)+"..."); //$JR_EXPR_ID=9$
                                                                                                                                 <-->
6 errors
)

I checked packages in jasperreports-5.6.1.jar file, includes functions package. Exhaustive web search turned up nothing. What could it be?

like image 476
Bill Dolan Avatar asked Jan 30 '15 19:01

Bill Dolan


1 Answers

I have a similar error message. Where you able to resolve this? Works fine in Jaspersoft Studio 6.0.1, but throws this when compiling w/ Java:

The method IF(boolean, BigDecimal, BigDecimal) is undefined for the type Blank_A4_1_1423164610392_674232

Update: I was able to solve this by including the functions jar on my classpath. See that if that works for you. See jasperreports-functions-5.6.1.jar at http://sourceforge.net/projects/jasperreports/files/jasperreports/JasperReports%205.6.1/

like image 144
angrycrab Avatar answered Oct 27 '22 10:10

angrycrab