error filling print... Error evaluating expression

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...

cik.ai87's picture
Joined: Feb 17 2016 - 10:37pm
Last seen: 6 years 5 months ago

The year format is DD/MM/YYYY. 10 character right..Or I wrong..

cik.ai87 - 6 years 11 months ago

Stacktrace shows another opinion. I belive in stacktrace

sanbez - 6 years 11 months ago

1 Answer:

>Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 10

Are you sure that $P{yearFrom} containt 10 characters?

www.tutorialspoint.com/java/lang/string_substring_index.htm

 

sanbez's picture
5414
Joined: Jan 11 2011 - 2:06am
Last seen: 2 years 3 months ago
Feedback