Jump to content

Recommended Posts

Posted

Hi,
im trying to create a template in A4 Letter to display some information.
In den Detail band of the mainReport I use the same subreport three times, but want to display the information in different sizes.
In detail I want to use a conditional style with a parameter from the mainReport to define the style size of the words.

I use the conditional style, but whenever the report is filled with data a ClassCastException is raised stating the following:
(when i try: new Boolean(true) as the expression it works, but as soon as I use a parameter oder a variable it fails)

net.sf.jasperreports.engine.JRException: java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Boolean (java.lang.Integer and java.lang.Boolean are in module java.base of loader 'bootstrap')
	at com.jaspersoft.studio.editor.preview.view.control.ReportController.fillReport(ReportController.java:550)
	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: java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Boolean (java.lang.Integer and java.lang.Boolean are in module java.base of loader 'bootstrap')
	at net.sf.jasperreports.engine.fill.JRFillElementContainer.buildConsolidatedStyle(JRFillElementContainer.java:941)
	at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluateConditionalStyle(JRFillElementContainer.java:902)
	at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluateConditionalStyles(JRFillElementContainer.java:890)
	at net.sf.jasperreports.components.list.FillListContents.evaluateContents(FillListContents.java:84)
	at net.sf.jasperreports.components.list.VerticalFillList.prepare(VerticalFillList.java:110)
	at net.sf.jasperreports.engine.fill.JRFillComponentElement.prepare(JRFillComponentElement.java:154)
	at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:352)
	at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:444)
	at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:419)
	at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2616)
	at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:837)
	at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:276)
	at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:119)
	at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:625)
	at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:435)
	at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:831)
	at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:61)
	at net.sf.jasperreports.engine.fill.AbstractThreadSubreportRunner.run(AbstractThreadSubreportRunner.java:221)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)



I further realized, that the syntax of version 6.23.1 differs to the syntax used in 7.0.1:

Old Sytax:

<conditionalStyle>
  <conditionExpression><![CDATA[new Boolean ($F{FuelType}.equals(""))]]></conditionExpression>
  <style 
         name="Fueltype1"
         isDefault="false"
         backcolor="#EAEAEA"
         >
  </style>
</conditionalStyle>

New Syntax:

<style name="rowStyle" style="row_midSize_ext">
  <conditionalStyle fontSize="6.0">
  <conditionExpression><![CDATA[$F{rowSizeField} > 1]]></conditionExpression>
  </conditionalStyle>
</style>


Can anyone explain me a possible problem?

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...