cik.ai87 Posted February 18, 2016 Posted February 18, 2016 Hi,I got the above message.Looks like there is an object type error but I can't find what exactly. Furthermore this syntax still works perfectly with jasperreport 4.0.1.Any advice about what I should change ?Thanks.CODING :Error filling print... Error evaluating expression : Source text : $P{yearFrom}.substring(8,10)+"/"+$P{yearFrom}.substring(5,7)+"/"+$P{yearFrom}.substring(0,4)+" - "+$P{yearTo}.substring(8,10)+"/"+$P{yearTo}.substring(5,7)+"/"+$P{yearTo}.substring(0,4)net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression : Source text : $P{yearFrom}.substring(8,10)+"/"+$P{yearFrom}.substring(5,7)+"/"+$P{yearFrom}.substring(0,4)+" - "+$P{yearTo}.substring(8,10)+"/"+$P{yearTo}.substring(5,7)+"/"+$P{yearTo}.substring(0,4) at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:195) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:589) at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:557) at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:929) at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:383) at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:368) at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:258) at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:499) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillBandNoOverflow(JRVerticalFiller.java:439) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageHeader(JRVerticalFiller.java:403) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:166) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:946) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:845) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247) at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:877) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997) Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 10 at java.lang.String.substring(String.java:1934) at REVHP001_1455777262509_89010.evaluate(REVHP001_1455777262509_89010:345) at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:182) ... 18 more Print not filled. Try to use an EmptyDataSource...
Solution sanbez Posted February 18, 2016 Solution Posted February 18, 2016 >Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 10Are you sure that $P{yearFrom} containt 10 characters?www.tutorialspoint.com/java/lang/string_substring_index.htm
cik.ai87 Posted February 19, 2016 Author Posted February 19, 2016 The year format is DD/MM/YYYY. 10 character right..Or I wrong..
sanbez Posted February 19, 2016 Posted February 19, 2016 Stacktrace shows another opinion. I belive in stacktrace
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