muneer Posted March 24, 2009 Share Posted March 24, 2009 i am new in reportingi am using iReport 3.0...i want to show my line in report if a field value is greater than 5000my field type is BigDecimali wrote formula as (($F{AvgAmount}.intValue() >= 5000 )? true : false )when i check expression result is *Expression successfully validated.*when i Run report error accour following the code ...how can i remove this error .thanks Code:Errors compiling .BranchWiseAverage.jasper. net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:1. Cannot cast from boolean to BigDecimal value = (java.math.BigDecimal)(((((java.math.BigDecimal)field_AvgAmount.getValue()).intValue() >= 5000 )? true : false ));//$JR_EXPR_ID=14$ <--------------------------------------------------------------------------------------------------------------->2. Cannot cast from boolean to BigDecimal value = (java.math.BigDecimal)(((((java.math.BigDecimal)field_AvgAmount.getOldValue()).intValue() >= 5000 )? true : false ));//$JR_EXPR_ID=14$ <------------------------------------------------------------------------------------------------------------------>3. Cannot cast from boolean to BigDecimal value = (java.math.BigDecimal)(((((java.math.BigDecimal)field_AvgAmount.getValue()).intValue() >= 5000 )? true : false ));//$JR_EXPR_ID=14$ <--------------------------------------------------------------------------------------------------------------->3 errors at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:193) at it.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:591) at java.lang.Thread.run(Unknown Source)Compilation running time: 328 Link to comment Share on other sites More sharing options...
kchaudhry Posted March 24, 2009 Share Posted March 24, 2009 Try thisnew Boolean(($F{AvgAmount}.intValue() >= 5000 )? true : false )or new Boolean($F{AvgAmount}.intValue() >= 5000 )Hope this helps!Post Edited by Kaleem Chaudhry at 03/24/09 14:57 Link to comment Share on other sites More sharing options...
muneer Posted March 25, 2009 Author Share Posted March 25, 2009 same error occur in both casesCode: ÂCompiling to file... .BranchWiseAverage.jasper -> C:Program FilesJasperSoftiReport-3.0.0classic_landscape.javaErrors compiling .BranchWiseAverage.jasper. net.sf.jasperreports.engine.JRException:ÂErrorsÂwereÂencounteredÂwhenÂcompilingÂreportÂexpressionsÂclassÂfile: 1.ÂCannotÂcastÂfromÂBooleanÂtoÂBigDecimal ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂvalueÂ=Â(java.math.BigDecimal)(newÂBoolean(((java.math.BigDecimal)field_AvgAmount.getValue()).intValue()Â>=Â5000Â));//$JR_EXPR_ID=14$ ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ<---------------------------------------------------------------------------------------------------------> 2.ÂCannotÂcastÂfromÂBooleanÂtoÂBigDecimal ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂvalueÂ=Â(java.math.BigDecimal)(newÂBoolean(((java.math.BigDecimal)field_AvgAmount.getOldValue()).intValue()Â>=Â5000Â));//$JR_EXPR_ID=14$ ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ<------------------------------------------------------------------------------------------------------------> 3.ÂCannotÂcastÂfromÂBooleanÂtoÂBigDecimal ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂvalueÂ=Â(java.math.BigDecimal)(newÂBoolean(((java.math.BigDecimal)field_AvgAmount.getValue()).intValue()Â>=Â5000Â));//$JR_EXPR_ID=14$ ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ<---------------------------------------------------------------------------------------------------------> 3Âerrors ÂÂÂÂatÂnet.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:193) ÂÂÂÂatÂit.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:591) ÂÂÂÂatÂjava.lang.Thread.run(UnknownÂSource) Compilation running time: 359. Post Edited by Muneer Ahmed at 03/25/09 07:41 Link to comment Share on other sites More sharing options...
kchaudhry Posted March 25, 2009 Share Posted March 25, 2009 Can you post your jrxml here? Link to comment Share on other sites More sharing options...
muneer Posted March 26, 2009 Author Share Posted March 26, 2009 i attached file.check it and tell me where i wrong Link to comment Share on other sites More sharing options...
kchaudhry Posted March 26, 2009 Share Posted March 26, 2009 Muneer,It seems like you have placed the expression in the wrong place. Its needs to be moved to the "print when expression" area which is listed under the "common" tab. As for the textfield expression under the textfield tab that should only have $F{AvgAmount}.Hope this helps! 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