aubrey.offer Posted January 29, 2013 Share Posted January 29, 2013 Hi AllI am trying to do what everyone else seems to do naturally :)I want to have my title sheet as a cover sheet with the title of the report and the parameters used in the report.If I remove the tick from the property (title on new page) this report runs, but the title page is on the same page as the report.I have set thein the report parameter as ticked. This returns the error of Error filling print... java.lang.Integer cannot be cast to java.math.BigDecimal java.lang.ClassCastException: java.lang.Integer cannot be cast to java.math.BigDecimal at net.sf.jasperreports.engine.fill.JRBigDecimalSumIncrementer.increment(JRBigDecimalIncrementerFactory.java:335) at net.sf.jasperreports.engine.fill.JRAbstractExtendedIncrementer.increment(JRAbstractExtendedIncrementer.java:42) at net.sf.jasperreports.engine.fill.JRCalculator.calculateVariables(JRCalculator.java:144) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:765) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:288) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:151) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:909) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:822) at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:61) at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:446) at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:276) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:745) at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:891) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997) Print not filled. Try to use an EmptyDataSource... Link to comment Share on other sites More sharing options...
aubrey.offer Posted January 29, 2013 Author Share Posted January 29, 2013 If I change ALL my variables (which should be java.math.BigDecimal) to integer this then works. The Problem is that the values pulled in (from an oracle database) are of the variable type number(16,4). Which should be java.math.BigDecimal according to the conversion of SQL to JAVA (unless this has changed) ... This means that my data is now not correct. Link to comment Share on other sites More sharing options...
sanbez Posted January 29, 2013 Share Posted January 29, 2013 net.sf.jasperreports.engine.fill.JRCalculator.calculateVariables(JRCalculator.java:144) Check type of fields (variables) on consistence. If $F{field1} has type Integer, then $V{sumField1} must be Integer, and so on... Link to comment Share on other sites More sharing options...
sanbez Posted January 29, 2013 Share Posted January 29, 2013 Can you put jrxml? Link to comment Share on other sites More sharing options...
aubrey.offer Posted January 30, 2013 Author Share Posted January 30, 2013 <?xml version="1.0" encoding="UTF-8"?> ]]></defaultValueExpression></p><p> </parameter></p><p> <parameter name="DESPATCH_WHSE" class="java.lang.String"></p><p> <defaultValueExpression><![CDATA[ "C:\Users\aubrey.offer\Documents\Reports\" select lh.company_id,</p><p> loh.recv_whse_code,</p><p> (select whse_desc</p><p> from inv_whses whses</p><p> where whses.whse_code = loh.recv_whse_code) Recieving_Whse,</p><p> loh.transacting_whse,</p><p> (select whse_desc</p><p> from inv_whses whses</p><p> where whses.whse_code = loh.transacting_whse) Despatch_Whse,</p><p> oh.actual_despatched_date,</p><p> loh.order_no,</p><p> loh.despatch_number,</p><p> lol.product_code,</p><p> ip.product_desc,</p><p> sdh.container_no,</p><p> im.move_from_location Loct,</p><p> lol.load_pqty Quantity,</p><p> lol.load_sqty Tons,</p><p> user</p><p> from lds_load_hdr lh,</p><p> lds_load_order_hdr loh,</p><p> ord_order_hdr oh,</p><p> lds_load_order_lines lol,</p><p> inv_movements im,</p><p> inv_products ip,</p><p> inv_whses iw,</p><p> SOR_DESP_HDR@Serenity sdh</p><p> where lh.load_id = loh.load_id</p><p> and loh.order_id = oh.order_id</p><p> and loh.load_order_id = lol.load_order_id</p><p> and lol.product_code = ip.product_code</p><p> and loh.load_order_id = im.ref_doc_id</p><p> and iw.whse_code = lh.whse_code</p><p> and oh.order_id = sdh.ordr_id(+)</p><p> and lh.load_type = 'XFER'</p><p> and lh.load_status = 'COMPLETED'</p><p> and oh.order_status = 'INTRANSIT'</p><p> and im.move_type = 'XFER'</p><p> and loh.recv_whse_code = $P{RECIEVING_WHSE}</p><p> and loh.transacting_whse = $P{DESPATCH_WHSE} $F{QUANTITY} 0 $F{TONS} 0 $F{QUANTITY} 0 $F{TONS} 0 $F{TRANSACTING_WHSE} $F{RECV_WHSE_CODE} Recieving Warehouse $F{RECIEVING_WHSE} $V{REC_TOTAL_QTY} $V{REC_TOTAL_TONS} Total for Recieving Warehouse $F{RECV_WHSE_CODE} Despatching Warehouse $F{DESPATCH_WHSE} $F{TRANSACTING_WHSE} Despatch Date Order No Despatch No Product Code Product Description Container Quantity Tons Total for Despatching Warehouse $V{DESP_TOTAL_QTY} $V{DESP_TOTAL_TONS} $V{COLUMN_COUNT} $P{RECIEVING_WHSE} $F{USER} $P{REPORT_CONNECTION} $P{SUBREPORT_DIR} + "Transfer_Order_in_Transit_Coversheet.jasper" Transfer Orders in Transit Report new java.util.Date() $F{ACTUAL_DESPATCHED_DATE} $F{ORDER_NO} $F{DESPATCH_NUMBER} $F{PRODUCT_CODE} $F{PRODUCT_DESC} $F{CONTAINER_NO} $F{QUANTITY} $F{TONS} "Page "+$V{PAGE_NUMBER}+" of" " " + $V{PAGE_NUMBER} Link to comment Share on other sites More sharing options...
aubrey.offer Posted January 30, 2013 Author Share Posted January 30, 2013 Hi Sanbez, All the variables, and fields and Text Fields in the report are set to java.math.BigDecimal. The Table fields are Number(16,4) on an oracle 11g database. I have made a sub report and tried to run it that way, but the same problem arises. If I change all values to integer, it works, but then the data is not correct as all the values are now displayed as integers as opposed to real numbers eg 161.255 will be shown as 161 and the totals will be the sum of the integer values, not the real values. Link to comment Share on other sites More sharing options...
sanbez Posted January 30, 2013 Share Posted January 30, 2013 "All the variables, and fields and Text Fields in the report are set to java.math.BigDecimal" Stack trace says otherwise. My version JR is different from your version. I can not determine exactly where the error occurred. "My" src of jasper have empty 335 line at place net.sf.jasperreports.engine.fill.JRBigDecimalSumIncrementer.increment(JRBigDecimalIncrementerFactory.java:335 Source jasper have this lines (in my version, but in another place): BigDecimal value = (BigDecimal)variable.getIncrementedValue(); BigDecimal newValue = (BigDecimal)expressionValue; Check expression (?) in your jrxml (may be it's cast to Integer (?)). Check type of parameters, may be problem here.... and so on Without source code jasper and without jrxml we have only guess Link to comment Share on other sites More sharing options...
aubrey.offer Posted January 30, 2013 Author Share Posted January 30, 2013 Hi Sanbez, Thanks for your efforts, this is what I have discovered as a workaround ... 1. If I make a subreport and pass in the parameters, I can get everything to work, on the condition that no calculated fields are on the MASTER report. 2. If the master report has calculated fields that are set to java.math.BigDecimal, then I can set this up as a subreport, that is put into a dummy Master report. Believe it or not this works :) 3. Or, if I change ALL the variables that are set as java.math.BigDecimal except the query its self to java.lang.double it works as long as I don't have a number with more than four decimal places. (######.####) Hope this helps you to help others as well. Thanks again. Aubrey 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