我有一个由对象 { groupName, rowName, colName, value } 组成的数据源。我试图将字段 row,col,val 放在交叉表中,由组分隔 [组有标题]。数据对象的集合被存储为主要数据源。
当我尝试执行此操作时出现错误:
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)
有没有人对为什么会发生这种情况或如何解决它有任何建议?
最佳答案
我发现以下可能有帮助:*
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.
您必须尝试将所有数据放入详细信息部分,这将不允许交叉表组件聚合所有数据。
* jasperforge.org
关于jasper-reports - 递增交叉表数据集时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5543748/