Jump to content
Changes to the Jaspersoft community edition download ×

crosstab fill exception


2004 IR Help

Recommended Posts

By: Ritesh Gopal - riteshg

crosstab fill exception

2005-11-05 12:55

I'm trying to use the crosstab feature and keep getting the following exception when I try to fill data. The report compiles ok.

 

What does this exception mean basically ?

 

fill:

[java] net.sf.jasperreports.engine.JRException: Crosstab data has already been processed.

[java] at net.sf.jasperreports.crosstabs.fill.calculation.BucketingService.addData(BucketingService.java:210)

[java] at net.sf.jasperreports.engine.fill.JRFillCrosstab$JRFillCrosstabDataset.customIncrement(JRFillCrosstab.java

[java] at net.sf.jasperreports.engine.fill.JRFillElementDataset.increment(JRFillElementDataset.java:132)

[java] at net.sf.jasperreports.engine.fill.JRCalculator.calculateVariables(JRCalculator.java:154)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:579)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:249)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:131)

[java] at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:834)

[java] at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:705)

[java] at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:63)

[java] at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247)

[java] at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:138)

[java] at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:94)

[java] at CrosstabApp.main(CrosstabApp.java:110)

 

[java] NESTED BY :

[java] net.sf.jasperreports.engine.JRException: Crosstab data has already been processed.

[java] at net.sf.jasperreports.crosstabs.fill.calculation.BucketingService.addData(BucketingService.java:210)

[java] at net.sf.jasperreports.engine.fill.JRFillCrosstab$JRFillCrosstabDataset.customIncrement(JRFillCrosstab.java

[java] at net.sf.jasperreports.engine.fill.JRFillElementDataset.increment(JRFillElementDataset.java:132)

[java] at net.sf.jasperreports.engine.fill.JRCalculator.calculateVariables(JRCalculator.java:154)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:579)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:249)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:131)

[java] at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:834)

[java] at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:705)

[java] at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:63)

[java] at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247)

[java] at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:138)

[java] at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:94)

[java] at CrosstabApp.main(CrosstabApp.java:110)

 

[java] NESTED BY :

[java] net.sf.jasperreports.engine.JRRuntimeException: Error incrementing crosstab dataset

[java] at net.sf.jasperreports.engine.fill.JRFillCrosstab$JRFillCrosstabDataset.customIncrement(JRFillCrosstab.java

[java] at net.sf.jasperreports.engine.fill.JRFillElementDataset.increment(JRFillElementDataset.java:132)

[java] at net.sf.jasperreports.engine.fill.JRCalculator.calculateVariables(JRCalculator.java:154)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:579)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:249)

[java] at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:131)

[java] at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:834)

[java] at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:705)

[java] at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:63)

[java] at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247)

[java] at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:138)

[java] at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:94)

[java] at CrosstabApp.main(CrosstabApp.java:110)

[java] Caused by: net.sf.jasperreports.engine.JRException: Crosstab data has already been processed.

[java] at net.sf.jasperreports.crosstabs.fill.calculation.BucketingService.addData(BucketingService.java:210)

[java] at net.sf.jasperreports.engine.fill.JRFillCrosstab$JRFillCrosstabDataset.customIncrement(JRFillCrosstab.java

[java] ... 12 more

[java] Java Result: 1

 

 

 

 

By: Lucian Chirita - lucianc

RE: crosstab fill exception

2005-11-05 15:40

Hi

 

The exception comes when you're trying to feed more data to the crosstab after rendering it (the engine doesn't support this).

 

What is your crosstab design? On which band does the crosstab lie and how does its dataset look (increment type, reset type)?

 

Regards,

Lucian

 

 

 

 

By: Ritesh Gopal - riteshg

RE: crosstab fill exception

2005-11-06 22:15

The crosstab is in the detail band and since I'm new to this, I don't know what the increment type and reset type datasets mean.

 

Basically I need a priority vs status crosstab

My sql query results are as follows:

---------------------------------------------------

Priority_display Status_display CT

P1 Closed 2

P1 Contract Execution 1

P1 Saved 10

P1 Submitted to Corp Dev. 12

P1 Vendor Evaluation/Selection 4

P1 Withdrawn 3

P2 Closed 1

P2 Contract Execution 1

P2 Contract Negotiation 1

P2 Corp Dev. Owner Assigned 15

P2 Saved 12

P2 Submitted to Corp Dev. 7

P2 Withdrawn 3

P3 Corp Dev. Owner Assigned 8

P3 Saved 25

P3 Submitted to Corp Dev. 4

P3 Vendor Evaluation/Selection 1

Purchasing Closed 2

Purchasing Contract Execution 1

Purchasing Contract Negotiation 3

Purchasing Corp Dev. Owner Assigned 8

Purchasing Saved 8

Purchasing Submitted to Corp Dev. 10

Purchasing Term Sheet Negotiation 2

Purchasing Vendor Evaluation/Selection 2

Purchasing Withdrawn 3

 

 

here's my jrxml file:

---------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>

<!-- Created using an evaluation version of JasperAssistant (http://www.jasperassistant.com) -->

<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

 

<jasperReport name="tplReport" language="java" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30">

<property name="com.jasperassistant.designer.GridWidth" value="12"/>

<property name="com.jasperassistant.designer.GridHeight" value="12"/>

<property name="com.jasperassistant.designer.DataSource" value="tpl-dev"/>

<property name="com.jasperassistant.designer.SnapToGrid" value="false"/>

<property name="com.jasperassistant.designer.Grid" value="false"/>

<queryString><![CDATA[select priority_display, status_display, ct from priority_x_status_matrix]]></queryString>

<field name="CT" class="java.math.BigDecimal">

</field>

<field name="PRIORITY_DISPLAY" class="java.lang.String">

</field>

<field name="STATUS_DISPLAY" class="java.lang.String">

</field>

<detail>

<band height="345">

<crosstab name="tplcrosstab" >

<reportElement x="5" y="20" width="812" height="100" mode="Opaque"/>

 

<crosstabDataset isDataPreSorted="true">

<dataset />

</crosstabDataset>

<rowGroup name="PriorityRow" width="80" totalPosition="End">

<bucket>

<bucketExpression class="java.lang.String">$F{PRIORITY_DISPLAY}</bucketExpression>

</bucket>

<crosstabRowHeader>

<cellContents>

<textField>

<reportElement x="5" y="0" width="75" height="30"/>

<textElement verticalAlignment="Middle">

<font isBold="true"/>

</textElement>

<textFieldExpression>$V{PriorityRow}</textFieldExpression>

</textField>

</cellContents>

</crosstabRowHeader>

<crosstabTotalRowHeader>

<cellContents>

<staticText>

<reportElement x="5" y="5" width="55" height="20"/>

<textElement>

<font isBold="true"/>

</textElement>

<text>Total</text>

</staticText>

</cellContents>

</crosstabTotalRowHeader>

</rowGroup>

 

<columnGroup name="StatusColumn" height="20" totalPosition="End">

<bucket>

<bucketExpression class="java.lang.String">$F{STATUS_DISPLAY}</bucketExpression>

</bucket>

<crosstabColumnHeader>

<cellContents>

<box borderColor="black" bottomBorder="1Point" leftBorder="1Point" topBorder="1Point"/>

<textField>

<reportElement x="0" y="0" width="60" height="20"/>

<textElement textAlignment="Center" verticalAlignment="Middle">

<font isBold="true"/>

</textElement>

<textFieldExpression>$V{StatusColumn}</textFieldExpression>

</textField>

</cellContents>

</crosstabColumnHeader>

<crosstabTotalColumnHeader>

<cellContents>

<box borderColor="black" border="1Point"/>

<staticText>

<reportElement x="0" y="0" width="60" height="20"/>

<textElement textAlignment="Center" verticalAlignment="Middle">

<font isBold="true"/>

</textElement>

<text>Total</text>

</staticText>

</cellContents>

</crosstabTotalColumnHeader>

</columnGroup>

 

<measure name="TicketCount" class="java.math.BigDecimal" calculation="Sum">

<measureExpression>$F{CT}</measureExpression>

</measure>

 

 

<crosstabCell width="60" height="30">

<cellContents backcolor="#FFFFFF">

<textField>

<reportElement x="0" y="0" width="60" height="15"/>

<textElement textAlignment="Center" verticalAlignment="Middle"/>

<textFieldExpression class="java.math.BigDecimal">$V{TicketCount}</textFieldExpression>

</textField>

</cellContents>

</crosstabCell>

 

<crosstabCell width="60" height="30" rowTotalGroup="PriorityRow">

<cellContents backcolor="yellow">

<box borderColor="black" bottomBorder="1Point" leftBorder="1Point"/>

<textField>

<reportElement x="0" y="0" width="60" height="30"/>

<textElement textAlignment="Center" verticalAlignment="Middle"/>

<textFieldExpression class="java.math.BigDecimal">$V{TicketCount}</textFieldExpression>

</textField>

</cellContents>

</crosstabCell>

 

<crosstabCell width="60" height="30" columnTotalGroup="StatusColumn">

<cellContents backcolor="green">

<box borderColor="black" bottomBorder="1Point" leftBorder="1Point" rightBorder="1Point"/>

<textField>

<reportElement x="0" y="0" width="60" height="15"/>

<textElement textAlignment="Center" verticalAlignment="Middle"/>

<textFieldExpression class="java.math.BigDecimal">$V{TicketCount}</textFieldExpression>

</textField>

</cellContents>

</crosstabCell>

 

 

<crosstabCell width="60" height="30" rowTotalGroup="PriorityRow" columnTotalGroup="StatusColumn">

<cellContents backcolor="gray">

<box borderColor="black" bottomBorder="1Point" leftBorder="1Point"/>

<textField>

<reportElement x="0" y="0" width="60" height="30"/>

<textElement textAlignment="Center" verticalAlignment="Middle"/>

<textFieldExpression class="java.math.BigDecimal">$V{TicketCount}</textFieldExpression>

</textField>

</cellContents>

</crosstabCell>

 

</crosstab>

</band>

</detail>

</jasperReport>

 

 

 

 

 

By: Lucian Chirita - lucianc

RE: crosstab fill exception

2005-11-07 00:26

If you want to display a crosstab aggregating all the data from your table, it doesn't make sense to place it on the detail band (this would display a crosstab for each row in the table).

 

Yous should place the crosstab on the summary band. This way, the crosstab will be fed data for each row in the table and the accumulated data will be rendered at the report end.

 

HTH,

Lucian

 

 

 

 

By: Ritesh Gopal - riteshg

RE: crosstab fill exception

2005-11-07 22:47

Thanks, that fixed the issue.

 

I based mine off the Shipments report crosstab sample that came with Jasper and has a crosstab in the detail band. Now I see that another sample (OrdersReport ) has crosstab in the summary band.

 

 

 

 

By: Lucian Chirita - lucianc

RE: crosstab fill exception

2005-11-07 23:52

Having a crosstab on the detail band makes sense only if using sub datasets (like the Shpiments sample does). Otherwise, there would be no data to aggregate in the crosstab.

 

Regards,

Lucian

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

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