Hi,
I am attempting to write some script that simplifies table sorting and have been getting quite close but am now wondering if I have found a bug...or have just misunderstood limitations.
So my relevant code:
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);
I am getting a NullPointerException on line 164 in the class Listing: org.eclipse.birt.report.engine.script.internal.element.Listing, in the method removeSortConditions...
((org.eclipse.birt.report.model.api.simpleapi.IListing) designElementImpl).removeSortConditions();
So the above implies 'designElementImpl' is null, having looked further at the source it seemed to imply that to instantiate the 'table' object, the following constructor was used:
public Table( TableHandle table );
And moving up the heirarchy of super classes, it implies that in the constructor of DesignElement, the following is returning null:
designElementImpl = SimpleElementFactory.getInstance( ).getElement(handle);
Any one any thoughts? Am I just not able to what I am trying to do?
Thanks in advance.
EDIT: Should probably add; I'm using BIRT 2.5.1.