remingtont Posted April 9, 2008 Share Posted April 9, 2008 Hello, I'm trying to create a complex expression that uses a comparison operator, however Jasper throws errors when it trys to compile my report. $F{BUDGET_AMOUNT}).intValue()==0? 0:new Double($F{BUDGET_SPENT_AMOUNT}.doubleValue() / $F{BUDGET_AMOUNT}.doubleValue()) The BUDGET_AMOUNT coming from my db is a double, however I need to convert it to an int for the comparison, I assume I also need to convert a part of this to a boolean but I'm not quite sure how to do that. Any help is appreciated. Link to comment Share on other sites More sharing options...
Telos Posted April 9, 2008 Share Posted April 9, 2008 We'd need the errors to give you any specific advice, but at glance I notice that you have an unopened paren right before .intValue(). Also from my experience, autoboxing doesn't always work when compiling jrxml, so you might want to replace intValue()==0?0 with intValue()==0? new Double(0) Link to comment Share on other sites More sharing options...
remingtont Posted April 12, 2008 Author Share Posted April 12, 2008 Sorry yes the unopened bracket was a typo on my part when I cut and pasted. I modified the expression which is now, in iReport when I validate the expression there are no issues. $F{BUDGET_AMOUNT}==0.00? new Double(0):new Double($F{BUDGET_SPENT_AMOUNT}.doubleValue() / $F{BUDGET_AMOUNT}.doubleValue()) I get the following two errors repeatedly when attempting to compile. ')' expected - this is expected just before the ending semi colon on the following line. value = (java.lang.Double)(((java.lang.Double)field_BUDGET_AMOUNT.getValue())==0.00? new Double(0):new Double(((java.lang.Double)field_BUDGET_SPENT_AMOUNT.getValue()).doubleValue()); ';' expected - this is expected at the third closing bracket just before the semi colon. value = (java.lang.Double)(((java.lang.Double)field_BUDGET_AMOUNT.getValue()).doubleValue())); 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