这是什么错误,如何防止这种情况?存储桶表达式值不具有可比性,并且未指定比较器 [英] what is this error and how do I prevent this? The bucket expression values are not comparable and no comparator specified

查看:120
本文介绍了这是什么错误,如何防止这种情况?存储桶表达式值不具有可比性,并且未指定比较器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jasperReports和dynamicReports,我想构建一个交叉表报告。到目前为止,我已经发现当我向rowGroups或columnGroups添加数字列时会发生此错误。这就是我得到的,我不知道为什么,我不知道如何解决这个问题。

Im using jasperReports with dynamicReports and I want to build a crosstab report. so far I have figured out that this error happens when I add columns that are numeric to rowGroups or columnGroups. this is what I get and I don't know why and I don't know how to solve this.

错误是:

The bucket expression values are not comparable and no comparator specified

我的代码是:

    CrosstabValues crosstabValues = report.getCrosstab().getCrosstabValues();
    Collection<CrosstabRowGroupBuilder> rowGroup = generateRowGroup(crosstabValues);
    Collection<CrosstabColumnGroupBuilder> columnGroup = generateColumnGroup(crosstabValues);
    Collection<CrosstabMeasureBuilder> measures = generateMeasures(crosstabValues);

    CrosstabBuilder crosstab = ctab.crosstab();

    for(CrosstabRowGroupBuilder row : rowGroup)
        crosstab.addRowGroup(row);
    for(CrosstabColumnGroupBuilder columnGroupBuilder : columnGroup)
        crosstab.addColumnGroup(columnGroupBuilder);
    for(CrosstabMeasureBuilder measure : measures)
        crosstab.addMeasure(measure);

    crosstab.headerCell(cmp.text(crosstabValues.getHeader())
    .setStyle(getCrosstabHeaderCellStyle(report.getTemplate().getReportTemplateValues())));


推荐答案

问题是我给这个方法的课程:

the problem was the class I was giving to this method:

CrosstabRowGroupBuilder cTabRow = ctab.rowGroup(column.getName()
, getColumnTypeClass(column));

我使用Number类来表示所有数字数据。有趣的是它适用于度量但它不适​​用于rowGroup或columnGroup。这就是为什么我感到困惑。

i was using Number class for all numeric data. the funny thing is that it worked for measures but it did not work for rowGroup or columnGroup. that is why I got confused.

现在使用Integer.Class或Long.Class它运作良好。

now with Integer.Class or Long.Class it works good.

这篇关于这是什么错误,如何防止这种情况?存储桶表达式值不具有可比性,并且未指定比较器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆