printWhenExpression on elements near by crosstab

0

Hi everyone!

I've got a text field on page header, a text field on page footer and a crosstab on report footer.
I need to print page header on first page of report and page footer on the rest pages. So I usualy use property 'print when expresson' that include next expression: '$V{PAGE_NUMBER} == 1' or '$V{PAGE_NUMBER} > 1'
But after adding crosstab on template I've got next error on generating report:

net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: $V{PAGE_NUMBER} == 1
    at com.jaspersoft.studio.editor.preview.view.control.ReportController.fillReport(ReportController.java:551)
    at com.jaspersoft.studio.editor.preview.view.control.ReportController.access$18(ReportController.java:526)
    at com.jaspersoft.studio.editor.preview.view.control.ReportController$1.run(ReportController.java:444)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: $V{PAGE_NUMBER} == 1
    at net.sf.jasperreports.engine.fill.JREvaluator.handleEvaluationException(JREvaluator.java:294)
    at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:328)
    at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:673)
    at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:641)
    at net.sf.jasperreports.engine.fill.JRFillDataset.evaluateExpression(JRFillDataset.java:2028)
    at net.sf.jasperreports.engine.fill.BaseReportFiller.evaluateExpression(BaseReportFiller.java:704)
    at net.sf.jasperreports.engine.fill.JRFillBand.evaluatePrintWhenExpression(JRFillBand.java:357)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageHeader(JRVerticalFiller.java:401)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:260)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:110)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:621)
    at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:135)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.UnsupportedOperationException
    at net.sf.jasperreports.compilers.DirectEvaluator.evaluate(DirectEvaluator.java:50)
    at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:313)
    ... 11 more


What I have to do to solve this problem?

P.S. if use only boolean value on band or text field then report will be generate correct

kuzkir89's picture
Joined: Nov 18 2015 - 1:25am
Last seen: 1 month 2 weeks ago

Could you please attach jrxml file instead of jasper?

alfpunk - 3 months 2 weeks ago

file attached

kuzkir89 - 3 months 2 weeks ago

1 Answer:

0

Hi,

I investigate a little you jrxml.

  1. You want to see your "Page Header" only on the first report page, so for this, you use the boolean expression. Instead of this overhead, you could use "Title" - it's displayed only on the first page.
  2. The main information in report display in the "Detail". So, my suggestion is to remove "Group Header" and "Group Footer". Create in "Detail" element list. This list element will contain:
    1. frame (if you need some 50px between header and crosstab, as you did via "Detail" just create this frame height 69px)
      1. with staticText Transportnoe predprijatie:
      2. and textField $F{parkTitle}
    2. list
      1. Crosstab

​​​​​​​​​​​​​​I can't locally reproduce your error, possibly something is wrong in crosstab element.

Удачи

 
alfpunk's picture
36
Joined: Apr 30 2020 - 1:04am
Last seen: 4 weeks 1 day ago
Feedback