gpt4 book ai didi

java - 使用 JS 以编程方式向 BIRT 中的表添加排序条件

转载 作者:行者123 更新时间:2023-11-29 09:25:36 27 4
gpt4 key购买 nike

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

所以我的相关代码:

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);

我在类 list 的第 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 );

向上移动父类(super class)的层次结构,这意味着在 DesignElement 的构造函数中,以下内容返回 null:

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

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

提前致谢。

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

最佳答案

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

我也在另一个论坛上发帖,所以如果有人想要更多详细信息,请参阅 BIRT Exchange Forums .

干杯。

关于java - 使用 JS 以编程方式向 BIRT 中的表添加排序条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2356272/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com