alauddinctgbd Posted November 20, 2006 Share Posted November 20, 2006 Hi, My database field in oracleRPT_SHOW_PRINTED_BY NUMERIC(1)returns 1 or 0 That is the field will be displayed if RPT_SHOW_PRINTED_BY=1 and will not be diplayed when RPT_SHOW_PRINTED_BY=0 But when i use in "printed by" Fieldproperties-->Print when expression---------------------------------------new Boolean($F{RPT_SHOW_PRINTED_BY})--------------------------------------it is showing error:------------------------------------------------Compiling to file... .footer.jasper -> C:Program FilesJasperSoftiReport-1.2.6footer.javaErrors compiling .footer.jasper!it.businesslogic.ireport.ReportClassLoader@32dc75 net.sf.jasperreports.engine.JRException:ÂErrorsÂwereÂencounteredÂwhenÂcompilingÂreportÂexpressionsÂclassÂfile: 1.ÂTheÂconstructorÂBoolean(BigDecimal)ÂisÂundefined ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂvalueÂ=Â(java.lang.Boolean)(newÂBoolean(((java.math.BigDecimal)field_RPT_SHOW_PRINTED_BY.getValue()))); ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ<-------------------------------------------------------------------------> 2.ÂTheÂconstructorÂBoolean(BigDecimal)ÂisÂundefined ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂvalueÂ=Â(java.lang.Boolean)(newÂBoolean(((java.math.BigDecimal)field_RPT_SHOW_PRINTED_BY.getOldValue()))); ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ<----------------------------------------------------------------------------> 3.ÂTheÂconstructorÂBoolean(BigDecimal)ÂisÂundefined ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂvalueÂ=Â(java.lang.Boolean)(newÂBoolean(((java.math.BigDecimal)field_RPT_SHOW_PRINTED_BY.getValue()))); ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ<-------------------------------------------------------------------------> 3Âerrors ÂÂÂÂatÂnet.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:193) ÂÂÂÂatÂnet.sf.jasperreports.engine.design.JRDefaultCompiler.compileReport(JRDefaultCompiler.java:105) ÂÂÂÂatÂnet.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:127) ÂÂÂÂatÂnet.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:109) ÂÂÂÂatÂit.businesslogic.ireport.IReportCompiler.run(IReportCompiler.java:507) ÂÂÂÂatÂjava.lang.Thread.run(Thread.java:595) Compilation running time : 547 ------------------------------------------------------HOW SHOULD I WRITE THE EXPRESSION. ALAUDDINPost edited by: alauddinctgbd, at: 2006/11/20 07:34 Link to comment Share on other sites More sharing options...
sarahmei Posted November 21, 2006 Share Posted November 21, 2006 This looks like a type issue. Your field is a BigDecimal, and you want to make it a Boolean. You can't cast between those types directly (hence the error). First I'd try to change the type of the field to something more useful. A decimal representation of a field that's always 0 or 1 doesn't make a lot of sense. If it must be a BigDecimal, then I'd try something like$F{RPT_SHOW_PRINTED_BY}.toBigInteger().equals(BigInteger.ONE)which returns a true if the original field is 1, and false if it's anything else. Because of the conversion from decimal to integer, though, you may run into odd errors if the field is slightly off from 0 or 1. 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