Error incrementing crosstab dataset

monksy picture monksy · Apr 4, 2011 · Viewed 19k times · Source

I have a data source that is composed of object { groupName, rowName, colName, value }. I'm trying to put the fields row,col,val in a crosstab, separated by group [the group has headers]. A collection of the data objects is being stored as the main datasource.

I'm gettting the error when I try to do this:

net.sf.jasperreports.engine.JRRuntimeException: Error incrementing crosstab dataset
    net.sf.jasperreports.engine.fill.JRFillCrosstab$JRFillCrosstabDataset.customIncrement(JRFillCrosstab.java:762)
    net.sf.jasperreports.engine.fill.JRFillElementDataset.increment(JRFillElementDataset.java:193)
    net.sf.jasperreports.engine.fill.JRCalculator.calculateVariables(JRCalculator.java:162)
    net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:747)

Does anyone have suggestions to why this is happening or how to fix it?

Answer

warren picture warren · Apr 4, 2011

I found the following which might help: *

What "Crosstab data has already been processed" exception means?

This exception is thrown if more data is added to the crosstab dataset after the crosstab has already been rendered.
This usually happens when a crosstab element is linked to the main dataset of the report (does not use a subdataset run) and the resetType attribute of the crosstab dataset does not match the place where the crosstab is rendered.
Crosstabs are special components that display aggregated data. And when they are linked to the main dataset of the report, you simply cannot put them in the detail section, because there is no data to aggregate from a single record.
Such crosstabs could only reside on a group footer or on the summary section of the report and have the appropriate resetType value, so that their dataset is initialized each time after they are rendered.
If you still think you need to render one crosstab for each detail in the master document, then almost certainly this crosstab should be linked to a subdataset and not to the main dataset of the report.

You must be trying to put all of the data in the detail section, which wouldn't allow for the crosstab component to agregate all of your data.

* jasperforge.org