2

我正在尝试编写一些脚本来简化表格排序并且已经非常接近但现在想知道我是否发现了一个错误......或者只是误解了限制。

所以我的相关代码:

var reportRunnable = reportContext.getReportRunnable();
var reportDesign = reportRunnable.getDesignInstance();
var table = reportDesign.getTable(tableName);

var sortCondition = org.eclipse.birt.report.engine.api.script.element.StructureScriptAPIFactory.createSortCondition();      
sortCondition.setKey("row[\"" + columnKey + "\"]");
sortCondition.setDirection("desc");

table.removeSortConditions();
table.addSortCondition(sortCondition);

我在类列表中的第 164 行收到 NullPointerException:org.eclipse.birt.report.engine.script.internal.element.Listing,在方法 removeSortConditions ...

((org.eclipse.birt.report.model.api.simpleapi.IListing) designElementImpl).removeSortConditions();

所以上面暗示'designElementImpl'为空,进一步查看源似乎暗示要实例化'table'对象,使用了以下构造函数:

public Table( TableHandle table );

并且向上移动超类的层次结构,这意味着在 DesignElement 的构造函数中,以下内容返回 null:

designElementImpl = SimpleElementFactory.getInstance( ).getElement(handle);

有人有什么想法吗?我只是不能做我想做的事吗?

提前致谢。

编辑:可能应该添加;我正在使用 BIRT 2.5.1。

4

1 回答 1

0

我想我现在已经对此进行了排序......我创建了一个没有库依赖项的 [更简单] 新报告,并且排序现在可以正常工作。

我也在另一个论坛上发过帖子,所以如果有人想了解更多详细信息,请参阅BIRT 交流论坛

干杯。

于 2010-03-02T09:52:55.043 回答