Jump to content
We've recently updated our Privacy Statement, available here ×

muneer

Recommended Posts

i am new in reporting

i am using iReport 3.0...

i want to show my line in report  if a field value is greater than 5000

my field type is BigDecimal

i 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

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

 same error occur in both cases

Code:
 Â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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...