iReport error in text field expression

0

 


 

I need to conver numbers in report to words. Downloaded and build .jar file named EnglishNumberToWords.jar and added to iReport classpath. When I run report it gives me an error :

Error filling print... Error evaluating expression :      Source text : EnglishNumberToWords.convert( $F{ODEMELER_MEBLEG} ) net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :      Source text : EnglishNumberToWords.convert( $F{ODEMELER_MEBLEG} )      at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:203)      at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:591)      at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:559)      at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:884)      at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:421)      at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:406)      at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:257)      at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:472)      at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2037)      at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:771)      at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:281)      at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:144)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:891)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:804)      at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:61)      at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:446)      at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:276)      at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:745)      at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:891)      at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)      at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)  Caused by: groovy.lang.MissingMethodException: No signature of method: static EnglishNumberToWords.convert() is applicable for argument types: (java.math.BigDecimal) values: [40] Possible solutions: convert(long), collect(groovy.lang.Closure), every(), collect(java.util.Collection, groovy.lang.Closure), every(groovy.lang.Closure)      at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1357)      at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1343)      at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.call(StaticMetaClassSite.java:50)      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)      at report2_1373433530151_637102.evaluate(calculator_report2_1373433530151_637102:193)      at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:190)      ... 20 more  Print not filled. Try to use an EmptyDataSource...

$F{ODEMELER_MEBLEG} type in oracle DB NUMBER(20,2)

Please help to solve this!

 

emil.maksimov's picture
Joined: Mar 29 2013 - 3:45am
Last seen: 5 years 5 months ago

1 Answer:

1

Caused by: groovy.lang.MissingMethodException: 

Make sure the default language of your rapport is "java" (right click on your report in the Report Inspector > properties)

darky.ben's picture
Joined: Jun 6 2013 - 12:14am
Last seen: 6 years 1 week ago

I have changed lang to Java and now have another error:
Compilation exceptions: com.jaspersoft.ireport.designer.compiler.ErrorsCollector@15f9ac0 net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file: 1. The method convert(long) in the type EnglishNumberToWords is not applicable for the arguments (BigDecimal)                 value = EnglishNumberToWords.convert( ((java.math.BigDecimal)field_ODEMELER_MEBLEG.getValue()) ); //$JR_EXPR_ID=16$                                              <-----> 2. The method convert(long) in the type EnglishNumberToWords is not applicable for the arguments (BigDecimal)                 value = EnglishNumberToWords.convert( ((java.math.BigDecimal)field_ODEMELER_MEBLEG.getOldValue()) ); //$JR_EXPR_ID=16$                                              <-----> 3. The method convert(long) in the type EnglishNumberToWords is not applicable for the arguments (BigDecimal)                 value = EnglishNumberToWords.convert( ((java.math.BigDecimal)field_ODEMELER_MEBLEG.getValue()) ); //$JR_EXPR_ID=16$                                              <-----> 3 errors     at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:204)     at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:512)     at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)     at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)

emil.maksimov - 6 years 1 week ago

try to replace
$F{ODEMELER_MEBLEG}
with
$F{ODEMELER_MEBLEG}.intValue()

darky.ben - 6 years 1 week ago

Thanks it works!

emil.maksimov - 6 years 1 week ago
show 1 more...

you're welcome (you can vote for that answer)

darky.ben - 6 years 1 week ago
Feedback