Hi,
I have a report where I want to use java class to convert amount to workds. I converted the Java Class file to a JAR file and added that JAR file (ADD JAR) via iReport.
Now, when I tried to run that report I see the error window pops up and show this:
Please guide me how to fix this.
Thank you
Regards
=================================================
Error Message
Errors were encountered when compiling report expressions class file: 1. com.HashmiTech.NumberToWords cannot be resolved to a type value = com.HashmiTech.NumberToWords.convert( ((java.lang.Double)field_grand_total.getValue()) ); //$JR_EXPR_ID=9$ <------------------------> 2. com.HashmiTech.NumberToWords cannot be resolved to a type value = com.HashmiTech.NumberToWords.convert( ((java.lang.Double)field_grand_total.getValue()) ); //$JR_EXPR_ID=10$ <------------------------> 3. com.HashmiTech.NumberToWords cannot be resolved to a type value = com.HashmiTech.NumberToWords.convert( ((java.lang.Double)field_grand_total.getOldValue()) ); //$JR_EXPR_ID=9$ <------------------------> 4. com.HashmiTech.NumberToWords cannot be resolved to a type value = com.HashmiTech.NumberToWords.convert( ((java.lang.Double)field_grand_total.getOldValue()) ); //$JR_EXPR_ID=10$ <------------------------> 5. com.HashmiTech.NumberToWords cannot be resolved to a type value = com.HashmiTech.NumberToWords.convert( ((java.lang.Double)field_grand_total.getValue()) ); //$JR_EXPR_ID=9$ <------------------------> 6. com.HashmiTech.NumberToWords cannot be resolved to a type value = com.HashmiTech.NumberToWords.convert( ((java.lang.Double)field_grand_total.getValue()) ); //$JR_EXPR_ID=10$ <------------------------> 6 errors
=================================================
2 Answers:
Seems like you have a data type problem. What datatype does com.HashmiTech.NumberToWords return? What's the expression where it's uses? Are you using Scriptlets? Try using a variable in your field or parameter expression and calling calling your java class in your variable, but before you do, try setting a value in your variable to make sure your expressions works.
<![CDATA[com.HashmiTech.NumberToWords.convert($F{grand_total})]]>
This is how I am calling this. It gets numbers for example, 34890.90 and then it converts it to "Thirty four thousand eight hundred and ninty Dollars and Ninty cents."
Is there anyone who can help ? Seems to be a dead forum.