2004 IR Help Posted September 2, 2006 Share Posted September 2, 2006 By: Todd - tberman333 Calculations - Division 2004-09-15 12:07 I am trying to divide two variables to get a percentage. I enter the following into the expression box: $V{Dealer_Balance}.doubleValue() / $V{Dealer_Limit}.doubleValue() When I try to compile it gives me the following message: dori.jasper.engine.JRException:?Errors?were?encountered?when?compiling?report?expressions?class?file: C:iReport-0.3.2CreditUtilization.java:164:?inconvertible?types found???:?double required:?java.lang.String ????????????????value?=?(java.lang.String)(((java.lang.Double)variable_Dealer_Balance.getValue()).doubleValue()?/?((java.lang.Double)variable_Dealer_Limit.getValue()).doubleValue()); ??????????????????????????????????????????^ C:iReport-0.3.2CreditUtilization.java:377:?inconvertible?types found???:?double required:?java.lang.String ????????????????value?=?(java.lang.String)(((java.lang.Double)variable_Dealer_Balance.getOldValue()).doubleValue()?/?((java.lang.Double)variable_Dealer_Limit.getOldValue()).doubleValue()); ??????????????????????????????????????????^ C:iReport-0.3.2CreditUtilization.java:590:?inconvertible?types found???:?double required:?java.lang.String ????????????????value?=?(java.lang.String)(((java.lang.Double)variable_Dealer_Balance.getEstimatedValue()).doubleValue()?/?((java.lang.Double)variable_Dealer_Limit.getEstimatedValue()).doubleValue()); ??????????????????????????????????????????^ 3?errors ????at?dori.jasper.engine.design.JRAbstractJavaCompiler.compileReport(JRAbstractJavaCompiler.java:155) ????at?dori.jasper.engine.design.JRDefaultCompiler.compileReport(JRDefaultCompiler.java:137) ????at?dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:138) ????at?dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:126) ????at?it.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:321) ????at?java.lang.Thread.run(Thread.java:534) Can anyone help me out? Thanks in advance. By: Gregory A. Swarthout - gswarthout RE: Calculations - Division 2004-09-15 12:20 You've indicated explicitly or as the default that this textField will be displaying a String, but the value you are giving it is the result of the division of one double by another. By: Andrew McLaughlin - pik0 RE: Calculations - Division 2004-09-15 12:42 Change the expression type to something like Double instead of String to make formatting easier. Then wrap your expression in a "new Double()" like this: new Double( $V{Dealer_Balance}.doubleValue() / $V{Dealer_Limit}.doubleValue() ) That should work properly. The thing to keep in mind, the expression result needs to match the expression type you specify in that dialog. In your case you specified String but your expression results in a "double" primitive value. iReport and Jasper Reports do not handle primitive result types. Piko By: Todd - tberman333 RE: Calculations - Division 2004-09-15 12:43 Ooops... I pasted the wrong error message. When I set my field type to jave.lang.Double, I get this error message: dori.jasper.engine.JRException:?Errors?were?encountered?when?compiling?report?expressions?class?file: C:iReport-0.3.2CreditUtilization.java:318:?inconvertible?types found???:?double required:?java.lang.Double ????????????????value?=?(java.lang.Double)(((java.lang.Double)variable_Dealer_Balance.getValue()).doubleValue()?/?((java.lang.Double)variable_Dealer_Limit.getValue()).doubleValue()); ??????????????????????????????????????????^ C:iReport-0.3.2CreditUtilization.java:601:?inconvertible?types found???:?double required:?java.lang.Double ????????????????value?=?(java.lang.Double)(((java.lang.Double)variable_Dealer_Balance.getOldValue()).doubleValue()?/?((java.lang.Double)variable_Dealer_Limit.getOldValue()).doubleValue()); ??????????????????????????????????????????^ C:iReport-0.3.2CreditUtilization.java:884:?inconvertible?types found???:?double required:?java.lang.Double ????????????????value?=?(java.lang.Double)(((java.lang.Double)variable_Dealer_Balance.getEstimatedValue()).doubleValue()?/?((java.lang.Double)variable_Dealer Thanks. By: Todd - tberman333 RE: Calculations - Division 2004-09-15 12:46 Piko. That worked. Thank you very much! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now